-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
32 lines (30 loc) · 1.09 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
find_package(Gettext REQUIRED)
find_program(XGETTEXT xgettext REQUIRED)
# Generate an up-to-date translation source .pot file from the C sources.
# NOTE: this is not your average build-something rule, this updates the
# rpm.pot SOURCE, which you then should commit into git.
add_custom_target(update-pot
COMMENT "Updating translation source"
COMMAND ${XGETTEXT}
--package-name=${CMAKE_PROJECT_NAME}
--package-version=${CMAKE_PROJECT_VERSION}
--output=${CMAKE_CURRENT_SOURCE_DIR}/rpm.pot
--language=C
--no-location
--keyword=_ --keyword=N_
--files-from=${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
SOURCES ${POT_SOURCES}
)
# Discover our translations
file(READ LINGUAS linguas)
string(REPLACE " " ";" linguas ${linguas})
set(linguas ${linguas})
# Copy translations to build tree to avoid modifying source
foreach(lang ${linguas})
string(STRIP ${lang} lang)
set(po ${lang}.po)
file(COPY ${po} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND pos ${CMAKE_CURRENT_BINARY_DIR}/${po})
endforeach()
GETTEXT_CREATE_TRANSLATIONS(rpm.pot ALL ${pos})