Running into a "Invalid setting 'Visual Studio' is not a valid 'settings.compiler' value." when running in VScode
KartikAiyer opened this issue · comments
I'm mostly a unix developer and I'm just trying to run some code on Windows 10 with VS code using Visual Studio 2019 toolchain. I've installed conan 2.0.14 and have conan cmake support script that downloads the conan-cmake
wrapper.
# Download automatically, you can also just copy the conan.cmake file
if( NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake" )
message( STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan" )
file( DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/0.18.1/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake" )
endif()
list( APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} )
list( APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR} )
include( ${CMAKE_BINARY_DIR}/conan.cmake )
macro( run_conan )
conan_cmake_configure( REQUIRES
${CONAN_EXTRA_REQUIRES}
GENERATORS
CMakeToolchain
CMakeDeps
OPTIONS
${CONAN_EXTRA_OPTIONS} )
conan_cmake_autodetect(settings)
conan_cmake_install(PATH_OR_REFERENCE .
BUILD missing
SETTINGS ${settings})
endmacro()
I then try to install fmtlib and spdlog
include(Conan)
set(CONAN_EXTRA_REQUIRES
fmt/10.1.1
spdlog/1.12.0)
run_conan()
and I'm running into this error when its trying to run conan install
[cmake] ERROR: Invalid setting 'Visual Studio' is not a valid 'settings.compiler' value.
[cmake] Possible values are ['sun-cc', 'gcc', 'msvc', 'clang', 'apple-clang', 'intel-cc', 'qcc', 'mcst-lcc']
The setting value is determined in the downloaded conan-cmake wrapper so I'm not sure why its not generating a value that is not accepted by conan. I'm also using kits in vscode which is currently selected to pickup the Visual Studio Community 2019 Release for x86_amd64 architecture. I also had to add a setting to my settings.json
to setup the IDE to specify CMAKE_BUILD_TYPE
when invoking Cmake since it wasn't doing that by default.
"cmake.configureSettings": {
"CMAKE_BUILD_TYPE": "${buildType}"
}
Any ideas what I can do to get past the problem ?
Thanks
Hi @KartikAiyer
Thanks for your question.
It seems you are using the legacy 1.X cmake-conan
integration, but instead installing Conan 2.0.
For Conan 2.0 you should be using the new transparent integration, in the develop2
branch of this repo, not this one, please check it: https://github.com/conan-io/cmake-conan/tree/develop2
Thank you very much for the help. That was indeed the issue. Closing this ticket.