+# Force c++11 language version
+# NOTE: It seems that by default on Visual Studio Compiler supports c++11,
+# so it only need to be test on other O.S.
+IF(NOT MSVC)
+ INCLUDE(CheckCXXCompilerFlag)
+ CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
+ IF(COMPILER_SUPPORTS_CXX11)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ ELSE(COMPILER_SUPPORTS_CXX11)
+ CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
+ IF(COMPILER_SUPPORTS_CXX0X)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+ ELSE(COMPILER_SUPPORTS_CXX0X)
+ MESSAGE(
+ FATAL_ERROR
+ "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support."
+ )
+ ENDIF(COMPILER_SUPPORTS_CXX0X)
+ ENDIF(COMPILER_SUPPORTS_CXX11)
+ENDIF(NOT MSVC)
+