Don't make pot-file generation optional.

It is needed for compiling translations. Not really, but the CMake module thinks
so.
This commit is contained in:
tastytea 2021-05-25 07:03:09 +02:00
parent 6d48f667fd
commit 28b1d5ec16
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 20 additions and 25 deletions

View File

@ -13,7 +13,6 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Project build options.
option(WITH_TESTS "Compile tests." NO)
option(GENERATE_POT "Generate / Update .pot file" YES)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

View File

@ -78,7 +78,6 @@ cmake --build . -- --jobs=$(nproc --ignore=1)
.CMake options:
* `-DCMAKE_BUILD_TYPE=Debug` for a debug build.
* `-DWITH_TESTS=YES` if you want to compile the tests.
* `-DGENERATE_POT=NO` to not (re-)generate the .pot file.
* `-DXGETTEXT_CMD=String` The program to use instead of `xgettext`.
include::{uri-base}/raw/branch/main/CONTRIBUTING.adoc[]

View File

@ -1,29 +1,26 @@
set(potfile "${PROJECT_SOURCE_DIR}/translations/${PROJECT_NAME}.pot")
file(GLOB po_src_files "../src/*pp")
if(GENERATE_POT)
file(GLOB po_src_files "../src/*pp")
add_custom_command(OUTPUT ${potfile}
COMMAND "${XGETTEXT_CMD}"
"--language=C++"
"--keyword=translate:1,1t"
"--keyword=translate:1c,2,2t"
"--keyword=translate:1,2,3t"
"--keyword=translate:1c,2,3,4t"
"--package-name=${PROJECT_NAME}"
"--package-version=${PROJECT_VERSION}"
"--from-code=utf-8"
"--foreign-user"
"--output=${potfile}"
${po_src_files}
DEPENDS "${po_src_files}"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
COMMENT "Extract translatable messages to ${potfile}")
add_custom_target(${PROJECT_NAME}_pot
ALL DEPENDS ${potfile})
add_custom_command(OUTPUT ${potfile}
COMMAND "${XGETTEXT_CMD}"
"--language=C++"
"--keyword=translate:1,1t"
"--keyword=translate:1c,2,2t"
"--keyword=translate:1,2,3t"
"--keyword=translate:1c,2,3,4t"
"--package-name=${PROJECT_NAME}"
"--package-version=${PROJECT_VERSION}"
"--from-code=utf-8"
"--foreign-user"
"--output=${potfile}"
${po_src_files}
DEPENDS "${po_src_files}"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
COMMENT "Extract translatable messages to ${potfile}")
add_custom_target(${PROJECT_NAME}_pot
ALL DEPENDS ${potfile})
unset(po_src_files)
endif(GENERATE_POT)
unset(po_src_files)
file(GLOB po_files "*.po")