Cmake build:

Add option LYX_ENABLE_CXX11 to enable C++11 mode for gnu CXX compiler
This commit is contained in:
Kornel Benko 2012-10-24 11:36:54 +02:00
parent d854ded56e
commit 28ebc59517

View File

@ -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()