CMake: Make GLOB work with new files (most of the time).
continuous-integration/drone/push Build is passing Details

Caveats: <https://cmake.org/cmake/help/latest/command/file.html#filesystem>
This commit is contained in:
tastytea 2021-05-31 11:06:29 +02:00
parent ea2fbc8dd7
commit 11a8989370
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 7 additions and 6 deletions

View File

@ -6,8 +6,8 @@ configure_file("fs-compat.hpp.in" "fs-compat.hpp" @ONLY)
# The library is only here for the tests.
add_library(${PROJECT_NAME}_lib STATIC)
file(GLOB_RECURSE sources_src *.cpp)
file(GLOB_RECURSE headers_src *.hpp)
file(GLOB sources_src CONFIGURE_DEPENDS *.cpp)
file(GLOB headers_src CONFIGURE_DEPENDS *.hpp)
list(REMOVE_ITEM sources_src "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp")
target_sources(${PROJECT_NAME}_lib

View File

@ -1,6 +1,6 @@
include(CTest)
file(GLOB sources_tests test_*.cpp)
file(GLOB sources_tests CONFIGURE_DEPENDS test_*.cpp)
file(COPY "test.zip" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY "test.epub2" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY "test.epub3" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

View File

@ -1,6 +1,7 @@
set(potfile "${PROJECT_SOURCE_DIR}/translations/${PROJECT_NAME}.pot")
file(GLOB po_src_files "../src/*pp")
file(GLOB po_src_files_relative RELATIVE "${PROJECT_SOURCE_DIR}" "../src/*pp")
file(GLOB po_src_files CONFIGURE_DEPENDS "../src/*pp")
file(GLOB po_src_files_relative CONFIGURE_DEPENDS
RELATIVE "${PROJECT_SOURCE_DIR}" "../src/*pp")
add_custom_command(OUTPUT ${potfile}
COMMAND "${XGETTEXT_CMD}"
@ -24,7 +25,7 @@ add_custom_target(${PROJECT_NAME}_pot
unset(po_src_files)
unset(po_src_files_relative)
file(GLOB po_files "*.po")
file(GLOB po_files CONFIGURE_DEPENDS "*.po")
# Hack to prevent GETTEXT_CREATE_TRANSLATIONS from updating the .po files.
set(backup_GETTEXT_MSGMERGE_EXECUTABLE ${GETTEXT_MSGMERGE_EXECUTABLE})