mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +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
@ -28,15 +28,15 @@ set(BUILD_SHARED_LIBS TRUE CACHE BOOL "TRUE to build SFML as shared libraries, F
|
||||
set(BUILD_EXAMPLES FALSE CACHE BOOL "TRUE to build the SFML examples, FALSE to ignore them")
|
||||
|
||||
# add an option for building the API documentation
|
||||
set(BUILD_DOC FALSE CACHE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
|
||||
|
||||
# Mac OS X specific options
|
||||
if (MACOSX)
|
||||
# (Not supported anymore by extlibs) add an option to compile ppc/ppc64
|
||||
#set(BUILD_PPC FALSE CACHE BOOL "TRUE to build SFML for ppc and ppc64, too, FALSE to only compile i386 and x86_64")
|
||||
|
||||
# add an option to build against 10.5 SDK
|
||||
set(BUILD_LEOPARD FALSE CACHE BOOL "TRUE to build SFML for OS X 10.5, FALSE to compile for default SDK")
|
||||
set(BUILD_DOC FALSE CACHE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
|
||||
|
||||
# Mac OS X specific options
|
||||
if (MACOSX)
|
||||
# (Not supported anymore by extlibs) add an option to compile ppc/ppc64
|
||||
#set(BUILD_PPC FALSE CACHE BOOL "TRUE to build SFML for ppc and ppc64, too, FALSE to only compile i386 and x86_64")
|
||||
|
||||
# add an option to build against 10.5 SDK
|
||||
set(BUILD_LEOPARD FALSE CACHE BOOL "TRUE to build SFML for OS X 10.5, FALSE to compile for default SDK")
|
||||
endif()
|
||||
|
||||
# define SFML_STATIC if the build type is not set to 'shared'
|
||||
@ -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)
|
||||
@ -64,39 +66,39 @@ if(COMPILER_MSVC)
|
||||
endif()
|
||||
|
||||
# disable the rpath stuff
|
||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||
|
||||
# Setup Mac OS X multi arch/SDK support.
|
||||
if (MACOSX)
|
||||
# # compile for PPC ?
|
||||
# if (BUILD_PPC)
|
||||
# if (NOT CMAKE_OSX_ARCHITECTURES)
|
||||
# # Custom : ppc, ppc64, i386 and x86_64
|
||||
# set(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64")
|
||||
# else()
|
||||
# # We got some conflict with custom user settings ; let him know his on his own.
|
||||
# message("You set BUILD_PPC to TRUE but CMAKE_OSX_ARCHITECTURES is not empty.")
|
||||
# message("You're on your own : I won't change your settings.")
|
||||
# endif()
|
||||
# else()
|
||||
# if (NOT CMAKE_OSX_ARCHITECTURES)
|
||||
# # Default : i386 and x86_64
|
||||
# set(CMAKE_OSX_ARCHITECTURES "i386;x86_64")
|
||||
# else()
|
||||
# # We got some conflict with custom user settings ; let him know his on his own.
|
||||
# message("CMAKE_OSX_ARCHITECTURES is not empty.")
|
||||
# message("You're on your own : I won't change your settings.")
|
||||
# endif()
|
||||
# endif()
|
||||
|
||||
# use 10.5 SDK ?
|
||||
if (BUILD_LEOPARD)
|
||||
# Use 10.5 SDK : override default value
|
||||
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5")
|
||||
else()
|
||||
# Default SDK, let either the user or CMake decide which one to use.
|
||||
endif()
|
||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||
|
||||
# Setup Mac OS X multi arch/SDK support.
|
||||
if (MACOSX)
|
||||
# # compile for PPC ?
|
||||
# if (BUILD_PPC)
|
||||
# if (NOT CMAKE_OSX_ARCHITECTURES)
|
||||
# # Custom : ppc, ppc64, i386 and x86_64
|
||||
# set(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64")
|
||||
# else()
|
||||
# # We got some conflict with custom user settings ; let him know his on his own.
|
||||
# message("You set BUILD_PPC to TRUE but CMAKE_OSX_ARCHITECTURES is not empty.")
|
||||
# message("You're on your own : I won't change your settings.")
|
||||
# endif()
|
||||
# else()
|
||||
# if (NOT CMAKE_OSX_ARCHITECTURES)
|
||||
# # Default : i386 and x86_64
|
||||
# set(CMAKE_OSX_ARCHITECTURES "i386;x86_64")
|
||||
# else()
|
||||
# # We got some conflict with custom user settings ; let him know his on his own.
|
||||
# message("CMAKE_OSX_ARCHITECTURES is not empty.")
|
||||
# message("You're on your own : I won't change your settings.")
|
||||
# endif()
|
||||
# endif()
|
||||
|
||||
# use 10.5 SDK ?
|
||||
if (BUILD_LEOPARD)
|
||||
# Use 10.5 SDK : override default value
|
||||
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5")
|
||||
else()
|
||||
# Default SDK, let either the user or CMake decide which one to use.
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# add the subdirectories
|
||||
|
@ -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