mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Changed the FORCE_STATIC_VCRT to STATIC_STD_LIBS, made it available for MinGW/gcc and set it to TRUE by default
This commit is contained in:
parent
0e826d8dec
commit
effc31327b
@ -49,10 +49,12 @@ if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
endif()
|
||||
|
||||
# define an option for choosing between static CRT and DLL CRT (with Visual C++)
|
||||
if(COMPILER_MSVC)
|
||||
set(FORCE_STATIC_VCRT FALSE CACHE BOOL "TRUE to force static VC++ runtimes, FALSE to use the DLL ones")
|
||||
if(FORCE_STATIC_VCRT)
|
||||
# define an option for choosing between static and dynamic C runtime (Windows only)
|
||||
if(WINDOWS)
|
||||
set(STATIC_STD_LIBS TRUE CACHE BOOL "TRUE to statically link to the standard libraries, FALSE to use them as DLLs")
|
||||
|
||||
# for VC++, we can apply it globally by modifying the compiler flags
|
||||
if(COMPILER_MSVC AND STATIC_STD_LIBS)
|
||||
foreach(flag
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
|
@ -126,10 +126,10 @@ macro(sfml_add_library target)
|
||||
set_target_properties(${target} PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR})
|
||||
set_target_properties(${target} PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
|
||||
# for gcc 4.x on Windows, we add the -static-libgcc linker flag to get rid of an extra gcc DLL
|
||||
if(WINDOWS AND COMPILER_GCC)
|
||||
# for gcc 4.x on Windows, apply the STATIC_STD_LIBS option if it is enabled
|
||||
if(WINDOWS AND COMPILER_GCC AND STATIC_STD_LIBS)
|
||||
if(${GCC_VERSION} MATCHES "4\\..*")
|
||||
set_target_properties(${target} PROPERTIES LINK_FLAGS -static-libgcc)
|
||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -178,10 +178,10 @@ macro(sfml_add_example target)
|
||||
# set the debug suffix
|
||||
set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
|
||||
|
||||
# for gcc 4.x on Windows, we add the -static-libgcc linker flag to get rid of an extra gcc DLL
|
||||
if(WINDOWS AND COMPILER_GCC)
|
||||
# for gcc 4.x on Windows, apply the STATIC_STD_LIBS option if it is enabled
|
||||
if(WINDOWS AND COMPILER_GCC AND STATIC_STD_LIBS)
|
||||
if(${GCC_VERSION} MATCHES "4\\..*")
|
||||
set_target_properties(${target} PROPERTIES LINK_FLAGS -static-libgcc)
|
||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user