Implement gcc version check for cmake

This commit is contained in:
Georg Baum 2016-06-05 15:54:29 +02:00
parent ad63374e26
commit c2433d8b8f

View File

@ -260,11 +260,7 @@ if(LYX_ENABLE_CXX11 MATCHES "AUTO")
else()
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT GCC_VERSION VERSION_LESS 4.3)
set(LYX_ENABLE_CXX11 ON CACHE TYPE STRING FORCE)
else()
set(LYX_ENABLE_CXX11 OFF CACHE TYPE STRING FORCE)
endif()
else()
# Not a gnu compiler
if(CMAKE_CXX_COMPILER_ID MATCHES "^[cC]lang$")
@ -280,6 +276,9 @@ if(UNIX OR MINGW)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Using GCC version ${GCC_VERSION}")
if(GCC_VERSION VERSION_LESS 4.9)
if(GCC_VERSION VERSION_LESS 4.3)
message(FATAL_ERROR "gcc >= 4.3 is required.")
endif()
# <regex> in gcc is unusable in versions less than 4.9.0
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631
set(LYX_USE_STD_REGEX 0)