cmake-conan
cmake-conan copied to clipboard
[bug] set(CONAN_EXTRA_OPTIONS "boost:header_only=True") not working with MSVC under Windows 10
Environment Details (include every applicable attribute)
- Operating System+version: Microsoft Windows 10 Pro Version 10.0.19042 Build 19042
- Compiler+version: MSVC 19.28.29914.0
- Conan version: 1.36.0
- Python version: 1.36.0
Steps to reproduce (Include if Applicable)
use Conan to have Boost and set the Conan extra option boost:header_only=True. It is failling as MSVC tries to link the Boost compiled libraries. The same Cmake works with a WSL/GCC build.
LINK : fatal error LNK1104: cannot open file 'libboost_random-vc142-mt-gd-x64-1_76.lib'
If I remove the option boost:header_only=True, the build works.
target_link_libraries(
intro
PRIVATE project_options
project_warnings
Boost::headers)
set(CONAN_EXTRA_OPTIONS "boost:header_only=True")
conan_cmake_run(
REQUIRES
${CONAN_EXTRA_REQUIRES}
boost/1.76.0
OPTIONS
${CONAN_EXTRA_OPTIONS}
BASIC_SETUP
CMAKE_TARGETS # individual targets to link to
BUILD
missing)
Logs (Executed commands with output) (Include/Attach if Applicable)
C:\Users\snoof\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\211.7142.21\bin\cmake\win\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - NMake Makefiles" D:\project\crypto_amm
-- The CXX compiler identification is MSVC 19.28.29914.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- No colored compiler diagnostic set for 'MSVC' compiler.
-- ccache found and enabled
-- Downloading conan.cmake from https://github.com/conan-io/cmake-conan
-- Conan: Automatic detection of conan settings from cmake
-- Conan: Detected VS runtime: MDd
-- Conan: Settings= -s;arch=x86_64;-s;build_type=Debug;-s;compiler=Visual Studio;-s;compiler.version=16;-s;compiler.runtime=MDd
-- Conan: checking conan executable
-- Conan: Found program C:/Users/snoof/anaconda3/Scripts/conan.exe
-- Conan: Version found Conan version 1.36.0
-- Conan executing: C:/Users/snoof/anaconda3/Scripts/conan.exe install . -s arch=x86_64 -s build_type=Debug -s compiler=Visual Studio -s compiler.version=16 -s compiler.runtime=MDd -g=cmake --build=missing -o=boost:header_only=True
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=Visual Studio
compiler.runtime=MDd
compiler.version=16
os=Windows
os_build=Windows
[options]
boost:header_only=True
[build_requires]
[env]
conanfile.txt: Installing package
Requirements
boost/1.76.0 from 'conan-center' - Cache
Packages
boost/1.76.0:524ea35a8120baabdde02483add58d81bf541327 - Cache
Installing (downloading, building) binaries...
boost/1.76.0: Already installed!
conanfile.txt: Generator cmake created conanbuildinfo.cmake
conanfile.txt: Generator txt created conanbuildinfo.txt
conanfile.txt: Generated conaninfo.txt
conanfile.txt: Generated graphinfo
-- Conan: Loading conanbuildinfo.cmake
-- Conan: Adjusting output directories
-- Conan: Using cmake targets configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: D:/project/crypto_amm/cmake-build-debug
Building Tests. Be sure to check out test/constexpr_tests for constexpr testing
-- Found Boost: C:/.conan/858d29/1/include (found version "1.76.0")
-- Configuring done
-- Generating done
-- Build files have been written to: D:/project/crypto_amm/cmake-build-debug
[Finished]
This seems an issue of cmake-conan, not Conan itself, moving to its repo.