cmake: some cleanup only

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17653 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2007-03-30 20:29:23 +00:00
parent d523af4b05
commit 0edd3bf6e0
12 changed files with 33 additions and 64 deletions

View File

@ -19,9 +19,7 @@ if(NOT MERGE_FILES)
add_library(boost_filesystem STATIC ${boost_filesystem_sources}) add_library(boost_filesystem STATIC ${boost_filesystem_sources})
else(NOT MERGE_FILES) else(NOT MERGE_FILES)
add_definitions(-D_WIN32_WINNT=0x500) add_definitions(-D_WIN32_WINNT=0x500)
lyx_merge_files(allinone boost_filesystem_sources) lyx_const_touched_files(_allinone const_touched_files boost_filesystem_sources)
add_library(boost_filesystem STATIC add_library(boost_filesystem STATIC ${const_touched_files})
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)

View File

@ -19,10 +19,8 @@ include_directories(${ZLIB_INCLUDE_DIR})
if(NOT MERGE_FILES) if(NOT MERGE_FILES)
add_library(boost_iostreams STATIC ${boost_iostreams_sources}) add_library(boost_iostreams STATIC ${boost_iostreams_sources})
else(NOT MERGE_FILES) else(NOT MERGE_FILES)
lyx_merge_files(allinone boost_iostreams_sources) lyx_const_touched_files(_allinone const_touched_files boost_iostreams_sources)
add_library(boost_iostreams STATIC add_library(boost_iostreams STATIC ${const_touched_files})
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)

View File

@ -19,9 +19,7 @@ lyx_add_path(boost_signals_sources ${TOP_SRC_DIR}/boost/libs/signals/src)
if(NOT MERGE_FILES) if(NOT MERGE_FILES)
add_library(boost_signals STATIC ${boost_signals_sources}) add_library(boost_signals STATIC ${boost_signals_sources})
else(NOT MERGE_FILES) else(NOT MERGE_FILES)
lyx_merge_files(allinone boost_signals_sources) lyx_const_touched_files(_allinone const_touched_files boost_signals_sources)
add_library(boost_signals STATIC add_library(boost_signals STATIC ${const_touched_files})
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)

View File

@ -126,16 +126,9 @@ MACRO (LYX_AUTOMOC)
endmacro (LYX_AUTOMOC) endmacro (LYX_AUTOMOC)
# For all C++ sources a big source file which includes all the files macro(lyx_const_touched_files _allinone_name _new_list _list)
# is created. set(_file_const ${CMAKE_CURRENT_BINARY_DIR}/${_allinone_name}_const.C)
# This is not done for the C sources, they are just gathered in a separate list set(_file_touched ${CMAKE_CURRENT_BINARY_DIR}/${_allinone_name}_touched.C)
# because they are usually not written by KDE and as such not intended to be
# compiled all-in-one.
macro (LYX_CREATE_FINAL_FILES _filenameCPP _filesExcludedFromFinalFile )
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_const} "//autogenerated file\n")
file(WRITE ${_file_touched} "//autogenerated file\n") file(WRITE ${_file_touched} "//autogenerated file\n")
@ -145,19 +138,21 @@ macro (LYX_CREATE_FINAL_FILES _filenameCPP _filesExcludedFromFinalFile )
file(APPEND ${_file_touched} "#define DONT_INCLUDE_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} "#include \"${_file_const}\"\n\n\n")
foreach (_current_FILE ${ARGN}) set(${_new_list} ${_file_const} ${_file_touched})
foreach (_current_FILE ${${_list}})
get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
# don't include any generated files in the final-file # don't include any generated files in the final-file
# because then cmake will not know the dependencies # because then cmake will not know the dependencies
get_source_file_property(_isGenerated ${_abs_FILE} GENERATED) get_source_file_property(_isGenerated ${_abs_FILE} GENERATED)
if (_isGenerated) if (_isGenerated)
list(APPEND ${_filesExcludedFromFinalFile} ${_abs_FILE}) list(APPEND ${_new_list} ${_abs_FILE})
else (_isGenerated) else (_isGenerated)
# don't include c-files in the final-file, because they usually come # don't include c-files in the final-file, because they usually come
# from a 3rd party and as such are not intended to be compiled all-in-one # from a 3rd party and as such are not intended to be compiled all-in-one
string(REGEX MATCH ".+\\.c$" _isCFile ${_abs_FILE}) string(REGEX MATCH ".+\\.c$" _isCFile ${_abs_FILE})
if (_isCFile) if (_isCFile)
list(APPEND ${_filesExcludedFromFinalFile} ${_abs_FILE}) list(APPEND ${_new_list} ${_abs_FILE})
else (_isCFile) else (_isCFile)
GET_FILENAME_COMPONENT(_file_name ${_abs_FILE} NAME_WE) GET_FILENAME_COMPONENT(_file_name ${_abs_FILE} NAME_WE)
@ -176,10 +171,6 @@ macro (LYX_CREATE_FINAL_FILES _filenameCPP _filesExcludedFromFinalFile )
endif (_isCFile) endif (_isCFile)
endif (_isGenerated) endif (_isGenerated)
endforeach (_current_FILE) endforeach (_current_FILE)
endmacro (LYX_CREATE_FINAL_FILES) endmacro(lyx_const_touched_files)
macro(lyx_merge_files _filename _list)
LYX_CREATE_FINAL_FILES(${_filename} _nix_nothing ${${_list}})
endmacro(lyx_merge_files _list _filename)

View File

@ -43,11 +43,8 @@ lyx_add_msvc_pch(lyx)
if(NOT MERGE_FILES) if(NOT MERGE_FILES)
set(lyx_sources ${lyx_sources} ${CMAKE_CURRENT_BINARY_DIR}/version.C) set(lyx_sources ${lyx_sources} ${CMAKE_CURRENT_BINARY_DIR}/version.C)
else(NOT MERGE_FILES) else(NOT MERGE_FILES)
lyx_merge_files(allinone lyx_sources) lyx_const_touched_files(_allinone const_touched_files lyx_sources)
set(lyx_sources set(lyx_sources ${const_touched_files} ${CMAKE_CURRENT_BINARY_DIR}/version.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C
${CMAKE_CURRENT_BINARY_DIR}/version.C
) )
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)

View File

@ -21,10 +21,8 @@ lyx_add_msvc_pch(frontends)
if(NOT MERGE_FILES) if(NOT MERGE_FILES)
add_library(frontends ${library_type} ${frontends_sources} ${frontends_headers}) add_library(frontends ${library_type} ${frontends_sources} ${frontends_headers})
else(NOT MERGE_FILES) else(NOT MERGE_FILES)
lyx_merge_files(allinone frontends_sources) lyx_const_touched_files(_allinone const_touched_files frontends_sources)
add_library(frontends ${library_type} add_library(frontends ${library_type} ${const_touched_files})
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)
project_source_group("${GROUP_CODE}" frontends_sources frontends_headers) project_source_group("${GROUP_CODE}" frontends_sources frontends_headers)

View File

@ -16,10 +16,8 @@ include_directories(${TOP_SRC_DIR}/src/frontends/controllers)
if(NOT MERGE_FILES) if(NOT MERGE_FILES)
add_library(controllers ${library_type} ${controllers_sources} ${controllers_headers}) add_library(controllers ${library_type} ${controllers_sources} ${controllers_headers})
else(NOT MERGE_FILES) else(NOT MERGE_FILES)
lyx_merge_files(allinone controllers_sources) lyx_const_touched_files(_allinone const_touched_files controllers_sources)
add_library(controllers ${library_type} add_library(controllers ${library_type} ${const_touched_files})
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)
target_link_libraries(controllers boost_regex boost_filesystem) target_link_libraries(controllers boost_regex boost_filesystem)

View File

@ -37,13 +37,12 @@ if(MERGE_FILES)
list(REVERSE frontends_qt4_sources) list(REVERSE frontends_qt4_sources)
list(REMOVE_ITEM frontends_qt4_sources ${TOP_SRC_DIR}/src/frontends/qt4/GuiApplication.C) 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) 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 const_touched_files frontends_qt4_sources)
set(depends_moc_uic ${frontends_qt4_headers} ${ui_files}) 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_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} add_library(frontend_qt4 ${library_type}
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C ${const_touched_files}
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C
${frontends_qt4_headers} ${frontends_qt4_headers}
${ui_files} ${ui_files}
) )

View File

@ -17,10 +17,8 @@ include_directories(${TOP_SRC_DIR}/src/graphics)
if(NOT MERGE_FILES) if(NOT MERGE_FILES)
add_library(graphics ${library_type} ${graphics_sources} ${graphics_headers}) add_library(graphics ${library_type} ${graphics_sources} ${graphics_headers})
else(NOT MERGE_FILES) else(NOT MERGE_FILES)
lyx_merge_files(allinone graphics_sources) lyx_const_touched_files(_allinone const_touched_files graphics_sources)
add_library(graphics ${library_type} add_library(graphics ${library_type} ${const_touched_files})
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)
project_source_group("${GROUP_CODE}" graphics_sources graphics_headers) project_source_group("${GROUP_CODE}" graphics_sources graphics_headers)

View File

@ -19,10 +19,8 @@ include_directories(${TOP_SRC_DIR}/src/insets)
if(NOT MERGE_FILES) if(NOT MERGE_FILES)
add_library(insets ${library_type} ${insets_sources} ${insets_headers}) add_library(insets ${library_type} ${insets_sources} ${insets_headers})
else(NOT MERGE_FILES) else(NOT MERGE_FILES)
lyx_merge_files(allinone insets_sources) lyx_const_touched_files(_allinone const_touched_files insets_sources)
add_library(insets ${library_type} add_library(insets ${library_type} ${const_touched_files})
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)

View File

@ -20,10 +20,8 @@ include_directories(${TOP_SRC_DIR}/src/mathed)
if(NOT MERGE_FILES) if(NOT MERGE_FILES)
add_library(mathed ${library_type} ${mathed_sources} ${mathed_headers}) add_library(mathed ${library_type} ${mathed_sources} ${mathed_headers})
else(NOT MERGE_FILES) else(NOT MERGE_FILES)
lyx_merge_files(allinone mathed_sources) lyx_const_touched_files(_allinone const_touched_files mathed_sources)
add_library(mathed ${library_type} add_library(mathed ${library_type} ${const_touched_files})
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)

View File

@ -35,10 +35,8 @@ else(NOT MERGE_FILES)
list(REMOVE_ITEM support_sources ${TOP_SRC_DIR}/src/support/lstrings.C) list(REMOVE_ITEM support_sources ${TOP_SRC_DIR}/src/support/lstrings.C)
list(APPEND support_sources ${TOP_SRC_DIR}/src/support/lstrings.C) list(APPEND support_sources ${TOP_SRC_DIR}/src/support/lstrings.C)
list(REVERSE support_sources) list(REVERSE support_sources)
lyx_merge_files(allinone support_sources) lyx_const_touched_files(_allinone const_touched_files support_sources)
add_library(support ${library_type} add_library(support ${library_type} ${const_touched_files})
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)