Permalink
Browse files

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."
  • Loading branch information...
osg-training-guest committed Nov 1, 2013
1 parent 57b98ff commit 16013670b38797cc4e6de4ee383c0eca9c174745
Showing with 23 additions and 4 deletions.
  1. +19 −4 CMakeLists.txt
  2. +4 −0 CMakeModules/OsgMacroUtils.cmake
View
@@ -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()
@@ -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()

0 comments on commit 1601367

Please sign in to comment.