]> Creatis software - cpPlugins.git/blobdiff - CMakeLists.txt
WARNING: It does not compile yet git status!
[cpPlugins.git] / CMakeLists.txt
index 797b910181a8bb3916e337d60f784520e85b3cf7..c15e1286d6f72ea8aa4a09aa2ed9595b83fca595 100644 (file)
@@ -47,6 +47,17 @@ ENDIF(BUILD_SHARED_LIBRARIES)
 ## = Packages and options =
 ## ========================
 
+INCLUDE(CheckCXXCompilerFlag)
+CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
+CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
+IF(COMPILER_SUPPORTS_CXX11)
+  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ELSEIF(COMPILER_SUPPORTS_CXX0X)
+  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+ELSE()
+  MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
+ENDIF()
+
 # Prepare header to build shared libs (windows)
 INCLUDE(GenerateExportHeader)