diff options
author | Chris Robinson <[email protected]> | 2011-02-08 00:34:25 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-02-08 00:34:25 -0800 |
commit | 667fd24c84e3674f74ca43a6a48521f7ed173a64 (patch) | |
tree | b54014d33300233c19d5889228ac5ba8fe88fb6b | |
parent | 9ffb38d6be446c563b751ffebeef66d6883486db (diff) |
Add an option to force usage of static MSVC runtimes
-rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e0d3e825..a0df2894 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,17 @@ IF(MSVC) INCLUDE_DIRECTORIES("${DXSDK_DIR}/Include") LINK_DIRECTORIES("${DXSDK_DIR}/Lib") ENDIF() + + OPTION(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF) + IF(FORCE_STATIC_VCRT) + FOREACH(flag_var + CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) + IF(${flag_var} MATCHES "/MD") + STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + ENDIF() + ENDFOREACH(flag_var) + ENDIF() ELSE() ADD_DEFINITIONS(-Winline -Wall) CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA) |