From a15aafa2a1e7fa2cedce13e15d0622bc31a3fe46 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sun, 6 Dec 2015 20:04:21 +0100 Subject: [PATCH] Use std::regex automatically in C++11 mode This is consistent with autotools. The only exception is MSVC, since we do not know yet whether it works. --- CMakeLists.txt | 8 ++++++++ development/cmake/ConfigureChecks.cmake | 2 ++ 2 files changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a87b049357..5840ad08a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -255,6 +255,10 @@ if(UNIX OR MINGW) # 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) + else() + if (LYX_ENABLE_CXX11) + set(LYX_USE_STD_REGEX 1) + endif() endif() if (LYX_ENABLE_CXX11) find_package(CXX11Compiler) @@ -856,6 +860,10 @@ if(QTVERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*") MATH(EXPR QT4_VERSION "(${CMAKE_MATCH_1}<<16)|(${CMAKE_MATCH_2}<<8)|${CMAKE_MATCH_3}") endif() +if (NOT HAVE_REGEX) + set(LYX_USE_STD_REGEX 0) +endif() + set (cmd ${CMAKE_CTEST_COMMAND}) if (MSVC) diff --git a/development/cmake/ConfigureChecks.cmake b/development/cmake/ConfigureChecks.cmake index b29416fab7..46ee11fcbc 100644 --- a/development/cmake/ConfigureChecks.cmake +++ b/development/cmake/ConfigureChecks.cmake @@ -33,6 +33,8 @@ foreach(_h_file aspell.h aspell/aspell.h limits.h locale.h check_include_files(${_h_file} HAVE_${_HF}) set(Include_Defines "${Include_Defines}#cmakedefine HAVE_${_HF} 1\n") endforeach() +check_include_file_cxx(regex HAVE_REGEX) +set(Include_Defines "${Include_Defines}#cmakedefine HAVE_REGEX 1\n") configure_file(${LYX_CMAKE_DIR}/configIncludes.cmake ${TOP_BINARY_DIR}/configIncludes.h.cmake) configure_file(${TOP_BINARY_DIR}/configIncludes.h.cmake ${TOP_BINARY_DIR}/configIncludes.h) -- 2.39.2