diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e0b9c3ef2..6b5fab40cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,7 @@ LYX_OPTION(DEBUG_GLIBC_PEDANTIC "Enable libstdc++pedantic debug mode" OFF GCC) LYX_OPTION(STDLIB_DEBUG "Use debug stdlib" OFF GCC) LYX_OPTION(CONCEPT_CHECKS "Enable concept-checks" OFF GCC) LYX_OPTION(PROFILE "Build with options for gprof" OFF GCC) +LYX_OPTION(ENABLE_CXX11 "Build with options for c++11-mode" OFF GCC) # MSVC specific LYX_OPTION(CONSOLE "Show console on Windows, enforce with =FORCE" ON MSVC) @@ -193,6 +194,7 @@ else() endif() +set(LYX_GCC11_MODE) if(UNIX OR MINGW) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) message(STATUS "Using GCC version ${GCC_VERSION}") @@ -202,6 +204,13 @@ if(UNIX OR MINGW) # http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.tr1 set(LYX_USE_TR1_REGEX 0) endif() + if (LYX_ENABLE_CXX11) + if(GCC_VERSION VERSION_GREATER 4.7) + set(LYX_GCC11_MODE "-std=gnu++11") + elseif(GCC_VERSION VERSION_GREATER 4.2) + set(LYX_GCC11_MODE "-std=gnu++0x") + endif() + endif() else() if(MSVC10) set(LYX_USE_TR1 1) @@ -429,7 +438,7 @@ if(NOT MSVC) if(NOT LYX_QUIET) set(CMAKE_VERBOSE_MAKEFILE ON) endif() - set(LYX_CXX_FLAGS "-Wall -Wunused-parameter") + set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_GCC11_MODE}") if(LYX_STDLIB_DEBUG) set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC") endif()