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")