From ff055f872aa31a548e1d73f4ea0d9394ba39d62c Mon Sep 17 00:00:00 2001 From: Stefan BrĂ¼ns Date: Mon, 1 Apr 2024 16:56:26 +0200 Subject: Regenerate pot/po files only if input has changed A custom target with ALL is always generated, even if the files/outputs specified with DPENDS are not changed. This can be solved by generating the POT files with a custom_command. The target triggers evaluation of the custom_command, but the latter will only be run if the dependencies have changed. Fixes #1479 --- utils/po/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/po/CMakeLists.txt b/utils/po/CMakeLists.txt index 5cd3a903..2eb7f0f0 100644 --- a/utils/po/CMakeLists.txt +++ b/utils/po/CMakeLists.txt @@ -15,12 +15,14 @@ macro(UPDATE_POT_FILE input) list(APPEND _commands COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} "${CMAKE_CURRENT_SOURCE_DIR}/${_potFile}") endforeach() - add_custom_target(update_pot_${input} - ALL + add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${_potFile} COMMAND xgettext --keyword=_ --language=c++ --package-name=pdfsig --output-dir=po --output=${_potFile} ${input}.cc ${_commands} - DEPENDS ../${input}.cc + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../${input}.cc WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) + add_custom_target(update_pot_${input} + ALL + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_potFile}) endmacro() UPDATE_POT_FILE(pdfsig) -- cgit v1.2.3