mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Use -stdlib=libc++ on macOS
This commit is contained in:
parent
14dd503c8a
commit
511c16329e
@ -356,6 +356,9 @@ else()
|
|||||||
# create SFML.framework
|
# create SFML.framework
|
||||||
add_library(SFML ${SFML_SOURCES})
|
add_library(SFML ${SFML_SOURCES})
|
||||||
|
|
||||||
|
# set the target flags to use the appropriate C++ standard library
|
||||||
|
sfml_set_stdlib(SFML)
|
||||||
|
|
||||||
# edit target properties
|
# edit target properties
|
||||||
set_target_properties(SFML PROPERTIES
|
set_target_properties(SFML PROPERTIES
|
||||||
FRAMEWORK TRUE
|
FRAMEWORK TRUE
|
||||||
|
@ -1,5 +1,27 @@
|
|||||||
include(CMakeParseArguments)
|
include(CMakeParseArguments)
|
||||||
|
|
||||||
|
# set the appropriate standard library on each platform for the given target
|
||||||
|
# ex: sfml_set_stdlib(sfml-system)
|
||||||
|
function(sfml_set_stdlib target)
|
||||||
|
# for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
|
||||||
|
if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4")
|
||||||
|
if(SFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM)
|
||||||
|
target_link_libraries(${target} "-static-libgcc" "-static-libstdc++")
|
||||||
|
elseif(NOT SFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM)
|
||||||
|
target_link_libraries(${target} "-shared-libgcc" "-shared-libstdc++")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (SFML_OS_MACOSX)
|
||||||
|
if (${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||||
|
set_property(TARGET ${target} PROPERTY XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
||||||
|
else()
|
||||||
|
target_compile_options(${target} PRIVATE "-stdlib=libc++")
|
||||||
|
target_link_libraries(${target} "-stdlib=libc++")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# add a new target which is a SFML library
|
# add a new target which is a SFML library
|
||||||
# ex: sfml_add_library(sfml-graphics
|
# ex: sfml_add_library(sfml-graphics
|
||||||
# SOURCES sprite.cpp image.cpp ...
|
# SOURCES sprite.cpp image.cpp ...
|
||||||
@ -50,14 +72,8 @@ macro(sfml_add_library target)
|
|||||||
# set the target's folder (for IDEs that support it, e.g. Visual Studio)
|
# set the target's folder (for IDEs that support it, e.g. Visual Studio)
|
||||||
set_target_properties(${target} PROPERTIES FOLDER "SFML")
|
set_target_properties(${target} PROPERTIES FOLDER "SFML")
|
||||||
|
|
||||||
# for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
|
# set the target flags to use the appropriate C++ standard library
|
||||||
if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4")
|
sfml_set_stdlib(${target})
|
||||||
if(SFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM)
|
|
||||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
|
||||||
elseif(NOT SFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM)
|
|
||||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-shared-libgcc -shared-libstdc++")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# For Visual Studio on Windows, export debug symbols (PDB files) to lib directory
|
# For Visual Studio on Windows, export debug symbols (PDB files) to lib directory
|
||||||
if(SFML_GENERATE_PDB)
|
if(SFML_GENERATE_PDB)
|
||||||
@ -182,14 +198,8 @@ macro(sfml_add_example target)
|
|||||||
# set the target's folder (for IDEs that support it, e.g. Visual Studio)
|
# set the target's folder (for IDEs that support it, e.g. Visual Studio)
|
||||||
set_target_properties(${target} PROPERTIES FOLDER "Examples")
|
set_target_properties(${target} PROPERTIES FOLDER "Examples")
|
||||||
|
|
||||||
# for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
|
# set the target flags to use the appropriate C++ standard library
|
||||||
if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4")
|
sfml_set_stdlib(${target})
|
||||||
if(SFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM)
|
|
||||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
|
||||||
elseif(NOT SFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM)
|
|
||||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-shared-libgcc -shared-libstdc++")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# link the target to its SFML dependencies
|
# link the target to its SFML dependencies
|
||||||
if(THIS_DEPENDS)
|
if(THIS_DEPENDS)
|
||||||
|
Loading…
Reference in New Issue
Block a user