]> git.lyx.org Git - features.git/commitdiff
TR1: check in cmake for GCC version, fallback in checktr1.h for other build systems...
authorPeter Kümmel <syntheticpp@gmx.net>
Wed, 30 Jun 2010 08:47:41 +0000 (08:47 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Wed, 30 Jun 2010 08:47:41 +0000 (08:47 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34728 a592a061-630c-0410-9148-cb99ea01b6c8

development/cmake/CMakeLists.txt
development/cmake/boost/libs/CMakeLists.txt
development/cmake/boost/libs/regex/CMakeLists.txt
src/support/checktr1.h
src/support/regex.h

index 2237d4856d9ace27d16978c2d7aba7d3ead61969..6bd35ca83d7e4e72d15c0aa4697a1a337c0c73cc 100644 (file)
@@ -27,6 +27,24 @@ set(LIBRARY_OUTPUT_PATH  ${CMAKE_BINARY_DIR}/lib)
 option(lyxinstall "Build install projects/rules" ON)
 
 
+if(UNIX)
+    # GCC does not support regex: there are linker errors
+    # http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.tr1
+    execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
+    if(GCC_VERSION VERSION_GREATER 4.4)
+        set(LYX_USE_TR1_REGEX 0)
+        add_definitions(-DLYX_USE_TR1)
+    endif()
+else()
+    if(MSVC10)
+        set(LYX_USE_TR1_REGEX 1)
+        add_definitions(-DLYX_USE_TR1)
+        add_definitions(-DLYX_USE_TR1_REGEX)
+    endif()
+endif()
+
+
+
 
 
 # Supress regeneration
@@ -328,7 +346,7 @@ if(NOT disable-pch)
                macro(lyx_add_msvc_pch name_)
                endmacro()
                macro(lyx_add_gcc_pch name_)
-                       add_definitions(-DLYX_PCH_STL -DLYX_PCH_BOOST -DLYX_PCH_QT4)
+                        add_definitions(-DLYX_PCH_STL -DLYX_PCH_BOOST -DLYX_PCH_QT4)
                        ADD_PRECOMPILED_HEADER(${name_} ${CMAKE_BINARY_DIR}/config_pch.cpp ${CMAKE_BINARY_DIR}/config.h.gch)
                endmacro()
        endif()
@@ -479,7 +497,11 @@ if(UseExternalBoost)
   endif()
 else()
   message(STATUS "----- Using internal boost. To build with installed version use -DUseExternalBoost:BOOL=ON")
-  set(Lyx_Boost_Libraries boost_signals ${BOOST_REGEX_LIB})
+  if(LYX_USE_TR1_REGEX)
+    set(Lyx_Boost_Libraries boost_signals)
+  else()
+    set(Lyx_Boost_Libraries boost_signals boost_regex)
+  endif()
   add_definitions(-DBOOST_USER_CONFIG="<config.h>")
   include_directories(${TOP_SRC_DIR}/boost)
   add_subdirectory(boost)
index 8430db812c806c7165e181d7bff1eb68f2eb4e79..c4ec26c182e742d1136795698111aab14a2e07ad 100644 (file)
@@ -1,16 +1,18 @@
 # This file is part of LyX, the document processor.
 # Licence details can be found in the file COPYING.
 #
-# Copyright (c) 2006, Peter Kümmel, <syntheticpp@gmx.net>
+# Copyright (c) 2010, Peter Kümmel, <syntheticpp@gmx.net>
 #
 
 project(boost)
 
-if(MSVC10)
+
+if(LYX_USE_TR1_REGEX)
        message(STATUS "Using TR1 regex")
 else()
        add_subdirectory(regex) 
 endif()
 
+
 add_subdirectory(signals) 
 
index efd427f3e7073f237593fe5089c1abd8fb0e15e7..0f65b40f819e13f961ac68fb5793a90f7d36b2ad 100644 (file)
@@ -21,5 +21,3 @@ lyx_add_path(boost_regex_sources ${TOP_SRC_DIR}/boost/libs/regex/src)
 
 add_library(boost_regex STATIC ${boost_regex_sources})
 
-set(BOOST_REGEX_LIB boost_regex CACHE STRING "Boost regex lib" FORCE)
-
index 9a4d23cc90e853d13279a2d86a1f7bdd2531e91f..da5d594aaaf585605968328133e286c4822c5c88 100644 (file)
@@ -12,6 +12,8 @@
 #ifndef LYX_CHECKTR1_H
 #define LYX_CHECKTR1_H
 
+#ifndef LYX_USE_TR1 // When not set by the build system
+
 #if defined(_MSC_VER) && (_MSC_VER >= 1600)
 #define LYX_USE_TR1
 #endif
@@ -20,5 +22,7 @@
 #define LYX_USE_TR1
 #endif
 
+#endif
+
 
 #endif
index 0826c9724ce6e82743e8bce9a6db0a4e1351fcfb..ef858743239cf56b1e7966040ac10a2cbbcc877e 100644 (file)
 
 
 
-// TODO: only tested with msvc10
-#if defined(LYX_USE_TR1) && defined(_MSC_VER)
+#if defined(LYX_USE_TR1) && defined(LYX_USE_TR1_REGEX)
 
 #ifdef _MSC_VER
 #include <regex>
-#define match_partial _Match_partial // why is match_partial not public?
+#define match_partial _Match_partial
 #else
-#include <tr1/regexp>
+#include <tr1/regex>
+// TODO no match_partial in gcc, how to replace?
+#define match_partial match_default
 #endif
 
 namespace lyx