From: Kornel Benko Date: Mon, 15 Oct 2012 20:50:39 +0000 (+0200) Subject: Cmake build: X-Git-Tag: 2.1.0beta1~1383 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=419f32df91d744378808afdf04bbe68cb8a11f9a;p=features.git Cmake build: Creating LYX_DATE dynamically at configure-time caused unwanted recompilation of the whole directories (src + src/tex2lyx) because all the relevant objects were dependent of a common file (flags.make in case of "Unix makefiles") which changed accordingly. There is now a new include (lyx_date.h, with only one definition) Nothing changes for automake, since in this case LYX_DATE is defined in config.h --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 00fe87056a..700ff04845 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -673,6 +673,7 @@ else() endif() configure_file(${LYX_CMAKE_DIR}/config.h.cmake ${TOP_BINARY_DIR}/config.h) +configure_file(${LYX_CMAKE_DIR}/lyx_date.h.cmake ${TOP_BINARY_DIR}/lyx_date.h) # Compute qt4-version from ${QTVERSION} if(QTVERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*") diff --git a/development/cmake/lyx_date.h.cmake b/development/cmake/lyx_date.h.cmake new file mode 100644 index 0000000000..ddbffea54e --- /dev/null +++ b/development/cmake/lyx_date.h.cmake @@ -0,0 +1,18 @@ +/* + * \file config.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * This is the compilation configuration file for LyX. + * It was generated by cmake. + * You might want to change some of the defaults if something goes wrong + * during the compilation. + */ + +#ifndef _LYX_DATE_H +#define _LYX_DATE_H + +#cmakedefine LYX_DATE "${LYX_DATE}" + +#endif + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7f57845bf1..5862136f01 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,8 +31,6 @@ list(REMOVE_ITEM lyx_sources ${TOP_SRC_DIR}/src/lyxinsets.cpp ${TOP_SRC_DIR}/src/lyxmathed.cpp) -set_property(SOURCE "${TOP_SRC_DIR}/src/version.cpp" APPEND PROPERTY COMPILE_DEFINITIONS LYX_DATE="${LYX_DATE}") - list(REMOVE_ITEM lyx_headers ${TOP_SRC_DIR}/src/Variables.h ${TOP_SRC_DIR}/src/Section.h) diff --git a/src/tex2lyx/CMakeLists.txt b/src/tex2lyx/CMakeLists.txt index 4fa809a395..1952a81251 100644 --- a/src/tex2lyx/CMakeLists.txt +++ b/src/tex2lyx/CMakeLists.txt @@ -21,8 +21,6 @@ foreach(_src graphics/GraphicsParams insets/ExternalTemplate list(APPEND LINKED_headers ${TOP_SRC_DIR}/src/${_src}.h) endforeach(_src) -set_property(SOURCE "${TOP_SRC_DIR}/src/version.cpp" APPEND PROPERTY COMPILE_DEFINITIONS LYX_DATE="${LYX_DATE}") - file(GLOB tex2lyx_sources ${TOP_SRC_DIR}/src/tex2lyx/${LYX_CPP_FILES}) file(GLOB tex2lyx_headers ${TOP_SRC_DIR}/src/tex2lyx/${LYX_HPP_FILES}) diff --git a/src/version.cpp b/src/version.cpp index 2ae59923a2..1e4aa32439 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -10,6 +10,9 @@ */ #include +#if ! defined(LYX_DATE) + #include +#endif /// extern char const * const lyx_version = PACKAGE_VERSION;