- use libc++ for all targets on macOS

clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9
This commit is contained in:
alexey.lysiuk 2018-05-06 09:44:13 +03:00
parent 4642861501
commit ce18ff1df3
2 changed files with 12 additions and 13 deletions

View File

@ -233,16 +233,22 @@ else()
set( REL_C_FLAGS "" ) set( REL_C_FLAGS "" )
set( DEB_C_FLAGS "" ) set( DEB_C_FLAGS "" )
# If we're compiling with a custom GCC on the Mac (which we know since g++-4.2 doesn't support C++11) statically link libgcc.
if( APPLE AND "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
set( ALL_C_FLAGS "-static-libgcc" )
endif()
if( NOT APPLE ) if( APPLE )
if( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
# With standard Apple tools -stdlib=libc++ needs to be specified in order to get
# C++11 support using SDKs 10.7 and 10.8.
set( CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS "-stdlib=libc++ ${CMAKE_EXE_LINKER_FLAGS}" )
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
# If we're compiling with a custom GCC on the Mac (which we know since g++-4.2 doesn't support C++11) statically link libgcc.
set( ALL_C_FLAGS "-static-libgcc" )
endif()
else()
# Generic GCC/Clang requires position independent executable to be enabled explicitly # Generic GCC/Clang requires position independent executable to be enabled explicitly
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fPIE" ) set( ALL_C_FLAGS "${ALL_C_FLAGS} -fPIE" )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie" ) set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie" )
endif() endif( APPLE )
endif() endif()
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${REL_LINKER_FLAGS}" ) set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${REL_LINKER_FLAGS}" )

View File

@ -362,13 +362,6 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
endif () endif ()
endif () endif ()
# With standard Apple tools -stdlib=libc++ needs to be specified in order to get
# C++11 support using SDKs 10.7 and 10.8.
if ( APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
set( CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS "-stdlib=libc++ ${CMAKE_EXE_LINKER_FLAGS}" )
endif ()
# Remove extra warnings when using the official DirectX headers. # Remove extra warnings when using the official DirectX headers.
# Also, TDM-GCC 4.4.0 no longer accepts glibc-style printf formats as valid, # Also, TDM-GCC 4.4.0 no longer accepts glibc-style printf formats as valid,
# which is a royal pain. The previous version I had been using was fine with them. # which is a royal pain. The previous version I had been using was fine with them.