From Stephan Huber, "Xcode changed the default std-lib-implementation again. Now it’s GNU++98 instead of C++11. I adapted the cMakeList.txt files accordingly to add this new option so we can set it explicitly and link against 3rdparty-c++-libs."

This commit is contained in:
Robert Osfield 2014-05-06 09:43:32 +00:00
parent eae4d51e3f
commit 754a163cbf

View File

@ -963,10 +963,11 @@ ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# remain unset. # remain unset.
IF (APPLE) 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) MARK_AS_ADVANCED(OSG_CXX_LANGUAGE_STANDARD)
# remove existing flags # remove existing flags
REMOVE_CXX_FLAG(-std=c++98) REMOVE_CXX_FLAG(-std=c++98)
REMOVE_CXX_FLAG(-std=gnu++98)
REMOVE_CXX_FLAG(-std=c++11) REMOVE_CXX_FLAG(-std=c++11)
REMOVE_CXX_FLAG(-stdlib=libstdc++) REMOVE_CXX_FLAG(-stdlib=libstdc++)
REMOVE_CXX_FLAG(-stdlib=libc++) REMOVE_CXX_FLAG(-stdlib=libc++)
@ -975,11 +976,17 @@ ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++98") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++98")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -stdlib=libstdc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -stdlib=libstdc++")
ELSE()
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() ELSE()
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
ENDIF() ENDIF()
ENDIF()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual -Wno-conversion") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual -Wno-conversion")
set(WARNING_CFLAGS "") set(WARNING_CFLAGS "")