Add C++0x support in CMake
You need to add the flag to CMAKE_CXX_FLAGS
:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
I use this snippet for GCC, but it is a more complicated way:
if(CMAKE_COMPILER_IS_GNUCXX)
SET(ENABLE_CXX11 "-std=c++11")
EXECUTE_PROCESS(COMMAND "${CMAKE_CXX_COMPILER} -dumpversion" OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_LESS 4.7)
SET(ENABLE_CXX11 "-std=c++0x")
endif()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ENABLE_CXX11}")
endif()