Make MSVC static linkage optional
This commit is contained in:
parent
5002e68be7
commit
3e67b54d6f
1 changed files with 11 additions and 9 deletions
|
@ -279,7 +279,7 @@ endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
if (STATIC)
|
if (STATIC)
|
||||||
message(WARNING "Static builds are not available for MSVC")
|
message(STATUS "MSVC static builds only embed the C runtime library: SDL2 and FreeType are still dynamically linked")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Find dependencies
|
# Find dependencies
|
||||||
|
@ -296,14 +296,16 @@ if (MSVC)
|
||||||
set(FREETYPE_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/msvc/freetype/win32/freetype.lib")
|
set(FREETYPE_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/msvc/freetype/win32/freetype.lib")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Static-link the CRT, so we don't need to lug around 10 different DLLs
|
if(STATIC)
|
||||||
foreach(FLAG_VAR
|
# Static-link the CRT, so we don't need to lug around 10 different DLLs
|
||||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
foreach(FLAG_VAR
|
||||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||||
if(${FLAG_VAR} MATCHES "/MD")
|
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||||
string(REGEX REPLACE "/MD" "/MT" ${FLAG_VAR} "${${FLAG_VAR}}")
|
if(${FLAG_VAR} MATCHES "/MD")
|
||||||
endif()
|
string(REGEX REPLACE "/MD" "/MT" ${FLAG_VAR} "${${FLAG_VAR}}")
|
||||||
endforeach()
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Work around MSVC2003's lack of stdint.h
|
# Work around MSVC2003's lack of stdint.h
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
|
|
Loading…
Add table
Reference in a new issue