]> git.lyx.org Git - features.git/commitdiff
Use std::regex automatically in C++11 mode
authorGeorg Baum <baum@lyx.org>
Sun, 6 Dec 2015 19:04:21 +0000 (20:04 +0100)
committerGeorg Baum <baum@lyx.org>
Sun, 6 Dec 2015 19:04:21 +0000 (20:04 +0100)
This is consistent with autotools. The only exception is MSVC, since we do not
know yet whether it works.

CMakeLists.txt
development/cmake/ConfigureChecks.cmake

index a87b049357d195c3f2317321b4fe25981567aa25..5840ad08a03b388ba29b3b08fe1e056cc10b5ebf 100644 (file)
@@ -255,6 +255,10 @@ if(UNIX OR MINGW)
                # <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)
+       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)
index b29416fab7753ae131b6988da0de32c8e0c4e28c..46ee11fcbc9a52be682ccfec782a1afba1cae7cb 100644 (file)
@@ -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)