-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCMakeLists.txt
64 lines (59 loc) · 1.57 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
set(TS_FILES
sailfishos-chum-gui-de.ts
sailfishos-chum-gui-es.ts
sailfishos-chum-gui-et.ts
sailfishos-chum-gui-fi.ts
sailfishos-chum-gui-fr.ts
sailfishos-chum-gui-hu.ts
sailfishos-chum-gui-it.ts
sailfishos-chum-gui-pl.ts
sailfishos-chum-gui-ru.ts
sailfishos-chum-gui-sk.ts
sailfishos-chum-gui-sv.ts
sailfishos-chum-gui.ts
)
# Implementing custom logic as
# qt5_create_translation doesn't respect lrelease options
# Generate a list of input files
set(LST_FILE "${CMAKE_CURRENT_BINARY_DIR}/sources.txt")
file(GLOB_RECURSE SOURCES
"${CMAKE_SOURCE_DIR}/qml/*.qml"
"${CMAKE_SOURCE_DIR}/src/*.cpp"
)
string(REPLACE ";" "\n" LST_SOURCES "${SOURCES}")
file(GENERATE
OUTPUT ${LST_FILE}
CONTENT "${LST_SOURCES}"
)
foreach(TS ${TS_FILES})
set(TS "${CMAKE_CURRENT_SOURCE_DIR}/${TS}")
list(APPEND TS_FILES_ABS "${TS}")
# Add a command to update ts files
add_custom_command(
OUTPUT ${TS}
COMMAND Qt5::lupdate
ARGS -silent "@${LST_FILE}" -ts ${TS}
DEPENDS ${SOURCES}
)
# Add a command to compile qm files
get_filename_component(QM ${TS} NAME_WE)
set(QM ${QM}.qm)
list(APPEND QM_FILES ${QM})
add_custom_command(
OUTPUT ${QM}
COMMAND Qt5::lrelease
ARGS -idbased -silent ${TS} -qm ${QM}
MAIN_DEPENDENCY ${TS}
)
# Install qm files
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/${QM}"
DESTINATION share/sailfishos-chum-gui/translations
)
endforeach()
add_custom_target(translations
ALL
DEPENDS ${QM_FILES}
)
# Use in distfiles target
set(TS_FILES ${TS_FILES_ABS} PARENT_SCOPE)