Default to linking with /MT instead of /MD for VS.
This commit is contained in:
@@ -82,3 +82,31 @@ macro(check_compile_features BIN_DIR SOURCE_FILE GREETER GREET_SUCCESS GREET_FAI
|
|||||||
endif()
|
endif()
|
||||||
endmacro()
|
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()
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ if(NOT MSVC)
|
|||||||
else()
|
else()
|
||||||
# Turn this option on to enable using the Texture Font Generator.
|
# 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)
|
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()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ include("${SM_CMAKE_DIR}/SMDefs.cmake")
|
|||||||
# Put the predefined targets in separate groups.
|
# Put the predefined targets in separate groups.
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
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.
|
# 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.
|
# We may use C++ in this project, but the check works better with plain C headers.
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
|
|||||||
Reference in New Issue
Block a user