cmake-conan icon indicating copy to clipboard operation
cmake-conan copied to clipboard

Compiler toolset is not set automatically

Open rick-de-water opened this issue 4 years ago • 4 comments

I am using v0.14 of this script to build a project with Visual Studio 2019. I expected the value of settings.compiler.toolset to be 'v142', but instead it is None This information should be available to CMake (probably through CMAKE_VS_PLATFORM_TOOLSET), so it would be great if it could set it automatically like the rest of the compiler settings.

rick-de-water avatar Aug 12 '19 13:08 rick-de-water

Hi @rick-de-water, If you want cmake-conan to detect the toolset you have to provide the information through the command line when calling CMake via the cmake -T option.

cmake .. -G "Visual Studio 16 2019" -T v142

Hope this helps :)

czoido avatar Oct 31 '19 17:10 czoido

conan_cmake_run doesn't respect current toolset. I'm using older toolchain cmake -G"Visual Studio 16 2019" -Tversion=14.26

On higher level I have proper detection from my project(...) The CXX compiler identification is MSVC 19.26.28808.1

But it isn't forwarded to conan which just takes latest version "compiler.toolset=v142"

Nekto89 avatar Mar 11 '21 16:03 Nekto89

same when running

cmake -G"Visual Studio 16" -T v140

schwaerz avatar Sep 27 '21 15:09 schwaerz

Is it expected that you need to manually specify something like -DCONAN_SETTINGS_COMPILER_TOOLSET=v140 on the command line? Not sure whether this is even correct, but it seems to be able to create visual studio projects now...

schwaerz avatar Sep 27 '21 15:09 schwaerz