Make the static MSVC runtime linkage optional
I'd tell people to use CMAKE_MSVC_RUNTIME_LIBRARY instead, but, eh, it's too recent.
This commit is contained in:
parent
de1740b61c
commit
efa987d7ad
1 changed files with 2 additions and 1 deletions
|
@ -8,6 +8,7 @@ option(DEBUG_SAVE "Re-enable the ability to drag-and-drop save files onto the wi
|
||||||
|
|
||||||
option(LTO "Enable link-time optimisation" OFF)
|
option(LTO "Enable link-time optimisation" OFF)
|
||||||
option(NATIVE_OPTIMIZATIONS "Enable processor-specific optimisations (executable might not work on other architectures) (GCC-compatible compilers only)" OFF)
|
option(NATIVE_OPTIMIZATIONS "Enable processor-specific optimisations (executable might not work on other architectures) (GCC-compatible compilers only)" OFF)
|
||||||
|
option(MSVC_LINK_STATIC_RUNTIME "Link the static MSVC runtime library" OFF)
|
||||||
|
|
||||||
option(WARNINGS "Enable common compiler warnings (for GCC-compatible compilers and MSVC only)" OFF)
|
option(WARNINGS "Enable common compiler warnings (for GCC-compatible compilers and MSVC only)" OFF)
|
||||||
option(WARNINGS_ALL "Enable ALL compiler warnings (for Clang and MSVC only)" OFF)
|
option(WARNINGS_ALL "Enable ALL compiler warnings (for Clang and MSVC only)" OFF)
|
||||||
|
@ -41,7 +42,7 @@ if(COMPILER_IS_CLANG OR COMPILER_IS_GCC OR COMPILER_IS_ICC)
|
||||||
message(STATUS "Compiling with a GCC-compatible compiler")
|
message(STATUS "Compiling with a GCC-compatible compiler")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC AND MSVC_LINK_STATIC_RUNTIME)
|
||||||
# Statically-link the CRT (vcpkg static libs do this)
|
# Statically-link the CRT (vcpkg static libs do this)
|
||||||
foreach(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
foreach(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||||
if(${flag_var} MATCHES "/MD")
|
if(${flag_var} MATCHES "/MD")
|
||||||
|
|
Loading…
Add table
Reference in a new issue