Default to linking with /MT instead of /MD for VS.

This commit is contained in:
Jason Felds
2015-10-27 19:31:04 -04:00
parent ace6d9a1ad
commit 47d59c9dd7
3 changed files with 33 additions and 0 deletions
+28
View File
@@ -82,3 +82,31 @@ macro(check_compile_features BIN_DIR SOURCE_FILE GREETER GREET_SUCCESS GREET_FAI
endif()
endmacro()
# Borrowed from http://stackoverflow.com/q/10113017
macro(configure_msvc_runtime)
if(MSVC)
# Get the compiler options generally used.
list(APPEND COMPILER_VARIABLES
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
if (WITH_STATIC_LINKING)
set(TO_REPLACE "/MD")
set(REPLACE_WITH "/MT")
else()
set(TO_REPLACE "/MT")
set(REPLACE_WITH "/MD")
endif()
foreach(COMPILER_VARIABLE ${COMPILER_VARIABLES})
if (${COMPILER_VARIABLE} MATCHES "${TO_REPLACE}")
string(REGEX REPLACE "${TO_REPLACE}" "${REPLACE_WITH}" ${COMPILER_VARIABLE} "${${COMPILER_VARIABLE}}")
endif()
endforeach()
endif()
endmacro()
+2
View File
@@ -46,6 +46,8 @@ if(NOT MSVC)
else()
# Turn this option on to enable using the Texture Font Generator.
option(WITH_TEXTURE_GENERATOR "Build with the Texture Font Generator. Ensure the MFC library is installed." OFF)
# Turn this option off to use dynamic linking instead of static linking.
option(WITH_STATIC_LINKING "Build StepMania with static linking." ON)
endif()
if(WIN32)
+3
View File
@@ -45,6 +45,9 @@ include("${SM_CMAKE_DIR}/SMDefs.cmake")
# Put the predefined targets in separate groups.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Set up the linker flags for MSVC builds.
configure_msvc_runtime()
# Checks the standard include directories for c-style headers.
# We may use C++ in this project, but the check works better with plain C headers.
include(CheckIncludeFiles)