Currently in our MSVC toolchain we need to specify the following variables in our toolchain:
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER "19.0")
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14" CACHE INTERNAL "")
endif()
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "90" CACHE INTERNAL "")
Not specifying results in the project failing to configure:
"
CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/Compiler/CMakeCommonCompilerMacros.cmake:42 (message):
CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for MSVC
(d:/foobar/win/vc/14.27.29110/bin/Hostx64/x64/cl.exe) version
19.27.29112
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.20/Modules/Compiler/MSVC-C.cmake:14 (__compiler_check_default_language_standard)
C:/Program Files/CMake/share/cmake-3.20/Modules/CMakeCInformation.cmake:25 (include)
imported/pal/CMakeLists.txt:5 (project)
"
This isn’t ideal. Is there a way to avoid this?