Andre', our current solution
will produce the "forgotten include"
error, well known from the builds with
precompiled headers.

Attached a patch which enables the creation
of a _touched.C file for each .C file.
These touched files then are compiled separate,
and will fail if one has forgotten a to add an include.

Do you think I should also commit this patch?
It increases a bit the compile time because
of the multiple touched files.


Peter
Index: boost/libs/signals/CMakeLists.txt
===================================================================
--- boost/libs/signals/CMakeLists.txt   (revision 17619)
+++ boost/libs/signals/CMakeLists.txt   (working copy)
@@ -19,9 +19,9 @@
 if(NOT MERGE_FILES)
        add_library(boost_signals STATIC ${boost_signals_sources})
 else(NOT MERGE_FILES)
-       lyx_merge_files(allinone boost_signals_sources)
+       lyx_const_touched_files(allinone touched_files  boost_signals_sources)
        add_library(boost_signals STATIC 
                                        
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
-                                       
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
+                                       ${touched_files})
 endif(NOT MERGE_FILES)
 
Index: boost/libs/filesystem/CMakeLists.txt
===================================================================
--- boost/libs/filesystem/CMakeLists.txt        (revision 17619)
+++ boost/libs/filesystem/CMakeLists.txt        (working copy)
@@ -19,9 +19,9 @@
        add_library(boost_filesystem STATIC ${boost_filesystem_sources})
 else(NOT MERGE_FILES)
        add_definitions(-D_WIN32_WINNT=0x500)
-       lyx_merge_files(allinone boost_filesystem_sources)
+       lyx_const_touched_files(allinone touched_files  
boost_filesystem_sources)
        add_library(boost_filesystem STATIC 
                                        
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
-                                       
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
+                                       ${touched_files})
 endif(NOT MERGE_FILES)
 
Index: boost/libs/iostreams/CMakeLists.txt
===================================================================
--- boost/libs/iostreams/CMakeLists.txt (revision 17619)
+++ boost/libs/iostreams/CMakeLists.txt (working copy)
@@ -19,10 +19,10 @@
 if(NOT MERGE_FILES)
        add_library(boost_iostreams STATIC ${boost_iostreams_sources})
 else(NOT MERGE_FILES)
-       lyx_merge_files(allinone boost_iostreams_sources)
+       lyx_const_touched_files(allinone touched_files  boost_iostreams_sources)
        add_library(boost_iostreams STATIC                                      
                                        
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
-                                       
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
+                                       ${touched_files})
        
 endif(NOT MERGE_FILES)
 
Index: src/graphics/CMakeLists.txt
===================================================================
--- src/graphics/CMakeLists.txt (revision 17619)
+++ src/graphics/CMakeLists.txt (working copy)
@@ -17,10 +17,10 @@
 if(NOT MERGE_FILES)
        add_library(graphics ${library_type} ${graphics_sources} 
${graphics_headers})
 else(NOT MERGE_FILES)
-       lyx_merge_files(allinone graphics_sources)
+       lyx_const_touched_files(allinone touched_files  graphics_sources)
        add_library(graphics ${library_type} 
                                        
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
-                                       
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
+                                       ${touched_files})
 endif(NOT MERGE_FILES)
 
 project_source_group("${GROUP_CODE}" graphics_sources graphics_headers)
Index: src/frontends/controllers/CMakeLists.txt
===================================================================
--- src/frontends/controllers/CMakeLists.txt    (revision 17619)
+++ src/frontends/controllers/CMakeLists.txt    (working copy)
@@ -16,10 +16,10 @@
 if(NOT MERGE_FILES)
        add_library(controllers ${library_type} ${controllers_sources} 
${controllers_headers})
 else(NOT MERGE_FILES)
-       lyx_merge_files(allinone controllers_sources)
+       lyx_const_touched_files(allinone touched_files  controllers_sources)
        add_library(controllers ${library_type} 
                                        
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
-                                       
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
+                                       ${touched_files})
 endif(NOT MERGE_FILES)
 
 target_link_libraries(controllers boost_regex boost_filesystem)
Index: src/frontends/qt4/CMakeLists.txt
===================================================================
--- src/frontends/qt4/CMakeLists.txt    (revision 17619)
+++ src/frontends/qt4/CMakeLists.txt    (working copy)
@@ -37,13 +37,13 @@
        list(REVERSE frontends_qt4_sources)
        list(REMOVE_ITEM frontends_qt4_sources 
${TOP_SRC_DIR}/src/frontends/qt4/GuiApplication.C)
        list(APPEND frontends_qt4_sources 
${TOP_SRC_DIR}/src/frontends/qt4/GuiApplication.C)
-       lyx_merge_files(allinone frontends_qt4_sources)
+       lyx_const_touched_files(allinone touched_files frontends_qt4_sources)
        set(depends_moc_uic ${frontends_qt4_headers} ${ui_files})
        SET_SOURCE_FILES_PROPERTIES(allinone_const.C PROPERTIES OBJECT_DEPENDS 
"${depends_moc_uic}")
-       SET_SOURCE_FILES_PROPERTIES(allinone_touched.C PROPERTIES 
OBJECT_DEPENDS "${depends_moc_uic}")
+       #SET_SOURCE_FILES_PROPERTIES(allinone_touched.C PROPERTIES 
OBJECT_DEPENDS "${depends_moc_uic}")
        add_library(frontend_qt4 ${library_type} 
                                        
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
-                                       
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C
+                                       ${touched_files}
                                        ${frontends_qt4_headers} 
                                        ${ui_files}
        )
Index: src/frontends/CMakeLists.txt
===================================================================
--- src/frontends/CMakeLists.txt        (revision 17619)
+++ src/frontends/CMakeLists.txt        (working copy)
@@ -21,10 +21,10 @@
 if(NOT MERGE_FILES)
        add_library(frontends ${library_type} ${frontends_sources} 
${frontends_headers})
 else(NOT MERGE_FILES)
-       lyx_merge_files(allinone frontends_sources)
+       lyx_const_touched_files(allinone touched_files  frontends_sources)
        add_library(frontends ${library_type}                                   
                                        
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
-                                       
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
+                                       ${touched_files})
 endif(NOT MERGE_FILES)
 
 project_source_group("${GROUP_CODE}" frontends_sources frontends_headers)
Index: src/mathed/CMakeLists.txt
===================================================================
--- src/mathed/CMakeLists.txt   (revision 17619)
+++ src/mathed/CMakeLists.txt   (working copy)
@@ -20,10 +20,10 @@
 if(NOT MERGE_FILES)
        add_library(mathed ${library_type} ${mathed_sources} ${mathed_headers})
 else(NOT MERGE_FILES)
-       lyx_merge_files(allinone mathed_sources)
+       lyx_const_touched_files(allinone touched_files  mathed_sources)
        add_library(mathed ${library_type}
                                        
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
-                                       
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
+                                       ${touched_files})
 endif(NOT MERGE_FILES)
 
 
Index: src/insets/CMakeLists.txt
===================================================================
--- src/insets/CMakeLists.txt   (revision 17619)
+++ src/insets/CMakeLists.txt   (working copy)
@@ -19,10 +19,10 @@
 if(NOT MERGE_FILES)
        add_library(insets ${library_type} ${insets_sources} ${insets_headers})
 else(NOT MERGE_FILES)
-       lyx_merge_files(allinone insets_sources)
+       lyx_const_touched_files(allinone touched_files  insets_sources)
        add_library(insets ${library_type}
                                        
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
-                                       
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
+                                       ${touched_files})
 endif(NOT MERGE_FILES)
 
 
Index: src/support/CMakeLists.txt
===================================================================
--- src/support/CMakeLists.txt  (revision 17619)
+++ src/support/CMakeLists.txt  (working copy)
@@ -35,10 +35,10 @@
        list(REMOVE_ITEM support_sources ${TOP_SRC_DIR}/src/support/lstrings.C)
        list(APPEND support_sources ${TOP_SRC_DIR}/src/support/lstrings.C)
        list(REVERSE support_sources)
-       lyx_merge_files(allinone support_sources)
+       lyx_const_touched_files(allinone touched_files  support_sources)
        add_library(support ${library_type}
                                        
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
-                                       
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
+                                       ${touched_files})
                                        
 endif(NOT MERGE_FILES)
 
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt  (revision 17619)
+++ src/CMakeLists.txt  (working copy)
@@ -43,10 +43,10 @@
 if(NOT MERGE_FILES)
        set(lyx_sources ${lyx_sources} ${CMAKE_CURRENT_BINARY_DIR}/version.C)
 else(NOT MERGE_FILES)
-       lyx_merge_files(allinone lyx_sources)
+       lyx_const_touched_files(allinone touched_files  lyx_sources)
        set(lyx_sources 
                                        
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
-                                       
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C
+                                       ${touched_files}
                                        ${CMAKE_CURRENT_BINARY_DIR}/version.C
        )
 endif(NOT MERGE_FILES)
Index: modules/LyXMacros.cmake
===================================================================
--- modules/LyXMacros.cmake     (revision 17630)
+++ modules/LyXMacros.cmake     (working copy)
@@ -135,16 +135,11 @@
    set(${_filesExcludedFromFinalFile})
 
    set(_file_const ${CMAKE_CURRENT_BINARY_DIR}/${_filenameCPP}_const.C)
-   set(_file_touched ${CMAKE_CURRENT_BINARY_DIR}/${_filenameCPP}_touched.C)
-   
    file(WRITE ${_file_const} "//autogenerated file\n")
-   file(WRITE ${_file_touched} "//autogenerated file\n")
-   
-   file(APPEND ${_file_touched} "// touched files\n\n")
-   file(APPEND ${_file_touched} "// look for non-const files\n")
-   file(APPEND ${_file_touched} "#define DONT_INCLUDE_CONST_FILES\n")
-   file(APPEND ${_file_touched} "#include \"${_file_const}\"\n\n\n")
-   
+
+   set(_file_all_touched ${CMAKE_CURRENT_BINARY_DIR}/${_filenameCPP}_touched.C)
+   file(WRITE ${_file_all_touched} "//autogenerated file\n")
+         
    foreach (_current_FILE ${ARGN})
       get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
       # don't include any generated files in the final-file
@@ -169,10 +164,18 @@
             file(APPEND ${_file_const}  "#include \"${_abs_FILE}\"\n")
             file(APPEND ${_file_const}  "#endif\n\n")
             
+            set(_file_touched 
${CMAKE_CURRENT_BINARY_DIR}/${_file_name}_touched.C)
+            file(WRITE ${_file_touched} "//autogenerated file\n")
+   
+                       file(APPEND ${_file_touched} "// touched files\n\n")
+                       file(APPEND ${_file_touched} "// look for non-const 
files\n")
+                       file(APPEND ${_file_touched} "#define 
DONT_INCLUDE_CONST_FILES\n")
+                       file(APPEND ${_file_touched} "#include 
\"${_file_const}\"\n\n\n")
             file(APPEND ${_file_touched}  "#ifndef ${__macro_name}\n")
             file(APPEND ${_file_touched}  "#include \"${_abs_FILE}\"\n")
             file(APPEND ${_file_touched}  "#endif\n\n")
             
+            set(${_filesExcludedFromFinalFile} 
${${_filesExcludedFromFinalFile}} ${_file_touched})
          endif (_isCFile)
       endif (_isGenerated)
    endforeach (_current_FILE)
@@ -183,3 +186,7 @@
        LYX_CREATE_FINAL_FILES(${_filename} _nix_nothing ${${_list}})
 endmacro(lyx_merge_files _list _filename)
 
+
+macro(lyx_const_touched_files _filename _touched_files _list)
+       LYX_CREATE_FINAL_FILES(${_filename} ${_touched_files} ${${_list}})
+endmacro(lyx_const_touched_files _touched_files _list _filename)

Reply via email to