From 754a163cbfc06a49fdb86daa858d197e54d9b61e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 6 May 2014 09:43:32 +0000 Subject: [PATCH] =?UTF-8?q?From=20Stephan=20Huber,=20"Xcode=20changed=20th?= =?UTF-8?q?e=20default=20std-lib-implementation=20again.=20Now=20it?= =?UTF-8?q?=E2=80=99s=20GNU++98=20instead=20of=20C++11.=20I=20adapted=20th?= =?UTF-8?q?e=20cMakeList.txt=20files=20accordingly=20to=20add=20this=20new?= =?UTF-8?q?=20option=20so=20we=20can=20set=20it=20explicitly=20and=20link?= =?UTF-8?q?=20against=203rdparty-c++-libs."?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8b1c843e..d414fe1d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -963,10 +963,11 @@ ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # remain unset. IF (APPLE) - SET(OSG_CXX_LANGUAGE_STANDARD "C++11" CACHE STRING "set the c++ language standard (C++98 / C++11) for OSG" ) + SET(OSG_CXX_LANGUAGE_STANDARD "C++11" CACHE STRING "set the c++ language standard (C++98 / GNU++98 / C++11) for OSG" ) MARK_AS_ADVANCED(OSG_CXX_LANGUAGE_STANDARD) # remove existing flags REMOVE_CXX_FLAG(-std=c++98) + REMOVE_CXX_FLAG(-std=gnu++98) REMOVE_CXX_FLAG(-std=c++11) REMOVE_CXX_FLAG(-stdlib=libstdc++) REMOVE_CXX_FLAG(-stdlib=libc++) @@ -976,9 +977,15 @@ ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -stdlib=libstdc++") ELSE() - set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") - set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") + IF(${OSG_CXX_LANGUAGE_STANDARD} STREQUAL "gnu++98" OR ${OSG_CXX_LANGUAGE_STANDARD} STREQUAL "GNU++98") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++98") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98 -stdlib=libstdc++") + ELSE() + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") + ENDIF() ENDIF() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual -Wno-conversion")