How do I activate C++ 11 in CMake?

When I try to run a CMake generated makefile to compile my program, I get the error that range based for loops are not supported in C++ 98 mode. I tried adding add_definitions(-std=c++0x) to my CMakeLists.txt, but it did not help. I tried this too: if(CMAKE_COMPILER_IS_GNUCXX) add_definitions(-std=gnu++0x) endif() When I do g++ –version, I get: … Read more