From Stephan Huber, "Build Problem with osgGA at MacOS with Xcode 5"..."attached you'll find a possible solution for the issue. This will add a new option to cmake called OSG_CXX_LANGUAGE_STANDARD which defaults to C++11. If you set it to C++98 it will setup the project accordingly."

This commit is contained in:
Robert Osfield 2013-11-01 14:40:50 +00:00
parent a10e9c6950
commit ffb0a8e545
2 changed files with 23 additions and 4 deletions

View File

@ -824,10 +824,25 @@ ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# remain unset.
IF (APPLE)
# set standard lib, clang defaults to c++0x
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++98")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -stdlib=libstdc++ -Wno-overloaded-virtual -Wno-conversion")
SET(OSG_CXX_LANGUAGE_STANDARD "C++11" CACHE STRING "set the c++ language standard (C++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=c++11)
REMOVE_CXX_FLAG(-stdlib=libstdc++)
REMOVE_CXX_FLAG(-stdlib=libc++)
IF(${OSG_CXX_LANGUAGE_STANDARD} STREQUAL "c++98" OR ${OSG_CXX_LANGUAGE_STANDARD} STREQUAL "C++98")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++98")
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++")
ENDIF()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual -Wno-conversion")
set(WARNING_CFLAGS "")
ENDIF()
ENDIF()

View File

@ -532,3 +532,7 @@ MACRO(HANDLE_MSVC_DLL)
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/osg${OPENSCENEGRAPH_SOVERSION}-")
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES IMPORT_PREFIX "../")
ENDMACRO(HANDLE_MSVC_DLL)
MACRO(REMOVE_CXX_FLAG flag)
STRING(REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDMACRO()