cmake-conan
cmake-conan copied to clipboard
conan_cmake_autodetect on Windows with set(CMAKE_CXX_STANDARD 11) cause conan_cmake_install failure
Hello,
When using conan_cmake_autodetect, if CMAKE_CXX_STANDARD is set to 11, it results in defining settings.compiler.cppstd=11, which is someway the expected behavior... BUT...
Main issue is that MSVC does not support forcing the cppstd to 11 as stated in the error message and in conan doc "Possible values are ['None', '14', '17', '20']".
As MSVC/CMake does not complaint when CMAKE_CXX_STANDARD is set to 11 (I think it silently default to the next value, so C++14 in this case), shouldn't conan_cmake does the same to prevent having pretty confusing error for a newcomer ?
Hi @DavidPerretSN, Thanks for reporting, I don't think we can do anything to avoid this. It would be difficult to check all those errors in conan.cmake as you have to take all the information from the settings.yml from Conan to the cmake script and check before Conan fails.
Thank you for your answer.
With Visual Studio/CMake it seems that CMAKE_CXX_STANDARD 11 is equivalent to none (I checked the generated build.ninja files) as no extra flag is added to the compiler call (it starts adding flags when CMAKE_CXX_STANDARD is >= 14).
With that in mind, would it be possible that conan_cmake_autodetect sets cppstd to None when CMAKE_CXX_STANDARD is set to 11 and we're using VS ? Or maybe just adding 11 as a possible value in the default settings.yaml, but maybe it would cause issues with some generators.