CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT has hard-coded "DLL"
The new CMP0091 policy is finally helping MSVC compile options, but I have a small problem with the fact that CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT
can never be static.
In Windows-MSVC.cmake
at line 301:
cmake_policy(GET CMP0091 __WINDOWS_MSVC_CMP0091)
if(__WINDOWS_MSVC_CMP0091 STREQUAL "NEW")
set(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
else() ^^^
set(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT "")
endif()
unset(__WINDOWS_MSVC_CMP0091)
"DLL" is hard-coded at the end.
A possible solution is:
cmake_policy(GET CMP0091 __WINDOWS_MSVC_CMP0091)
if(__WINDOWS_MSVC_CMP0091 STREQUAL "NEW")
set(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT "MultiThreaded$<$<CONFIG:Debug>:Debug>")
if(NOT CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT_STATIC)
string(APPEND CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT "DLL")
endif()
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT "")
endif()
unset(__WINDOWS_MSVC_CMP0091)
Here, the new variable CMAKE_MSVC_RUNTIME_LIBRARY_DEFAULT_STATIC
is used as the switch, so the default behavior is the same.
Edited by Austin Smith