From: Peter Kümmel Date: Wed, 30 Jun 2010 08:47:41 +0000 (+0000) Subject: TR1: check in cmake for GCC version, fallback in checktr1.h for other build systems... X-Git-Tag: 2.0.0~3086 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=103310c40117ad916818ac52c0793d0e6c0c4e7e;p=features.git TR1: check in cmake for GCC version, fallback in checktr1.h for other build systems, no support of regex in gcc 4.4 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34728 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/development/cmake/CMakeLists.txt b/development/cmake/CMakeLists.txt index 2237d4856d..6bd35ca83d 100644 --- a/development/cmake/CMakeLists.txt +++ b/development/cmake/CMakeLists.txt @@ -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="") include_directories(${TOP_SRC_DIR}/boost) add_subdirectory(boost) diff --git a/development/cmake/boost/libs/CMakeLists.txt b/development/cmake/boost/libs/CMakeLists.txt index 8430db812c..c4ec26c182 100644 --- a/development/cmake/boost/libs/CMakeLists.txt +++ b/development/cmake/boost/libs/CMakeLists.txt @@ -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, +# Copyright (c) 2010, Peter Kümmel, # project(boost) -if(MSVC10) + +if(LYX_USE_TR1_REGEX) message(STATUS "Using TR1 regex") else() add_subdirectory(regex) endif() + add_subdirectory(signals) diff --git a/development/cmake/boost/libs/regex/CMakeLists.txt b/development/cmake/boost/libs/regex/CMakeLists.txt index efd427f3e7..0f65b40f81 100644 --- a/development/cmake/boost/libs/regex/CMakeLists.txt +++ b/development/cmake/boost/libs/regex/CMakeLists.txt @@ -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) - diff --git a/src/support/checktr1.h b/src/support/checktr1.h index 9a4d23cc90..da5d594aaa 100644 --- a/src/support/checktr1.h +++ b/src/support/checktr1.h @@ -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 diff --git a/src/support/regex.h b/src/support/regex.h index 0826c9724c..ef85874323 100644 --- a/src/support/regex.h +++ b/src/support/regex.h @@ -33,14 +33,15 @@ -// 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 -#define match_partial _Match_partial // why is match_partial not public? +#define match_partial _Match_partial #else -#include +#include +// TODO no match_partial in gcc, how to replace? +#define match_partial match_default #endif namespace lyx