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:
parent
6d48f667fd
commit
28b1d5ec16
@ -13,7 +13,6 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|||||||
|
|
||||||
# Project build options.
|
# Project build options.
|
||||||
option(WITH_TESTS "Compile tests." NO)
|
option(WITH_TESTS "Compile tests." NO)
|
||||||
option(GENERATE_POT "Generate / Update .pot file" YES)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
@ -78,7 +78,6 @@ cmake --build . -- --jobs=$(nproc --ignore=1)
|
|||||||
.CMake options:
|
.CMake options:
|
||||||
* `-DCMAKE_BUILD_TYPE=Debug` for a debug build.
|
* `-DCMAKE_BUILD_TYPE=Debug` for a debug build.
|
||||||
* `-DWITH_TESTS=YES` if you want to compile the tests.
|
* `-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`.
|
* `-DXGETTEXT_CMD=String` The program to use instead of `xgettext`.
|
||||||
|
|
||||||
include::{uri-base}/raw/branch/main/CONTRIBUTING.adoc[]
|
include::{uri-base}/raw/branch/main/CONTRIBUTING.adoc[]
|
||||||
|
@ -1,29 +1,26 @@
|
|||||||
set(potfile "${PROJECT_SOURCE_DIR}/translations/${PROJECT_NAME}.pot")
|
set(potfile "${PROJECT_SOURCE_DIR}/translations/${PROJECT_NAME}.pot")
|
||||||
|
file(GLOB po_src_files "../src/*pp")
|
||||||
|
|
||||||
if(GENERATE_POT)
|
add_custom_command(OUTPUT ${potfile}
|
||||||
file(GLOB po_src_files "../src/*pp")
|
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}
|
unset(po_src_files)
|
||||||
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)
|
|
||||||
|
|
||||||
file(GLOB po_files "*.po")
|
file(GLOB po_files "*.po")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user