CMake: copy clang and resource files only if necessary

Uses a timestamp file in the build directory to detect when the input
changes using DEPENDS from add_custom_command.

Total copied files size sum up to more than 260 MB. This was copied at every
incremental build, even if nothing changed.

This leads to faster build, especially when the copied files are not
cached in RAM or when not using a SSD.

Change-Id: I3a0b691b961e1d8591068bacf40ae2467c8637cf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Alexis Murzeau
2020-04-29 22:09:45 +02:00
parent 95d9eafc8a
commit a9aa561234
5 changed files with 64 additions and 48 deletions

View File

@@ -3,11 +3,7 @@ install(
DESTINATION "${IDE_DATA_PATH}"
)
add_custom_target(copy_fonts_to_builddir ALL VERBATIM)
add_custom_command(TARGET copy_fonts_to_builddir POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory fonts
"${PROJECT_BINARY_DIR}/${IDE_DATA_PATH}/fonts"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT Copy files into build directory
VERBATIM
qtc_copy_to_builddir(copy_fonts_to_builddir
DIRECTORIES fonts
DESTINATION "${IDE_DATA_PATH}/fonts"
)