1
0

CMake: MSVC builds use static CRT.

We don't want to be dependent on the VC runtime.
This commit is contained in:
madmaxoft 2014-01-14 11:45:06 +01:00
parent eb89de4c88
commit 20209750aa

View File

@ -60,6 +60,15 @@ if(LINUX AND NOT CROSSCOMPILE)
endif()
# Use static CRT in MSVC builds:
if (MSVC)
string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
endif()
# Set lower warnings-level for the libraries:
if (MSVC)
# Remove /W3 from command line -- cannot just cancel it later with /w like in unix, MSVC produces a D9025 warning (option1 overriden by option2)