From ce18ff1df3752124dc845678ecca9deedd763b54 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 6 May 2018 09:44:13 +0300 Subject: [PATCH] - 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 --- CMakeLists.txt | 18 ++++++++++++------ src/CMakeLists.txt | 7 ------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa3fee462..cb3beeea9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,16 +233,22 @@ else() set( REL_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 set( ALL_C_FLAGS "${ALL_C_FLAGS} -fPIE" ) set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie" ) - endif() + endif( APPLE ) endif() set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${REL_LINKER_FLAGS}" ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3166de220..2f3cf6bb4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -362,13 +362,6 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) 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. # 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.