fix cppstd value for msvc compiler
Thanks for your contribution @oleksandr-prykhodko-quickbase
Quick question: why the
CMAKE_CXX_EXTENSIONSwill be defined if the compiler ismsvc? That sounds like an error in the input in the first place, if the compiler ismsvcthat variable shouldn't be True, isn't it?
It is indeed grey area, in the spirit of cmake and being compiler agnostic we set it ON for everything (as we do compile with different compilers). I think the question is whether this is an erroneous input: it really has no impact for msvc but is it necessarily restricted to set it ON (again in compiler agnostic world)?
It is indeed grey area, in the spirit of cmake and being compiler agnostic we set it ON for everything (as we do compile with different compilers). I think the question is whether this is an erroneous input: it really has no impact for msvc but is it necessarily restricted to set it ON (again in compiler agnostic world)?
Thanks for the feedback.
The approach that I have seen as recommended in different places is the one in this answer: https://stackoverflow.com/questions/48026483/setting-cmake-cxx-standard-to-various-values
if(NOT "${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 11)
endif()
Because CMakeLists.txt should respect compiler-specifications defined in CMake toolchain files, and this is the correct way to default something without invalidating possible definitions.
Let's ask @jcar87 about this one.