summaryrefslogtreecommitdiffhomepage
path: root/cmake/opentrack-i18n.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/opentrack-i18n.cmake')
-rw-r--r--cmake/opentrack-i18n.cmake34
1 files changed, 20 insertions, 14 deletions
diff --git a/cmake/opentrack-i18n.cmake b/cmake/opentrack-i18n.cmake
index 2e35ba6b..b98a469b 100644
--- a/cmake/opentrack-i18n.cmake
+++ b/cmake/opentrack-i18n.cmake
@@ -1,6 +1,10 @@
include_guard(GLOBAL)
add_custom_target(i18n ALL)
+add_custom_target(i18n-lupdate)
+add_custom_target(i18n-lrelease)
+add_dependencies(i18n-lrelease i18n-lupdate)
+add_dependencies(i18n i18n-lrelease)
function(otr_i18n_for_target_directory n)
set(k "opentrack-${n}")
@@ -8,9 +12,11 @@ function(otr_i18n_for_target_directory n)
get_property(lupdate-binary TARGET "${Qt5_LUPDATE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION)
set(target-names "")
+ #make_directory("${CMAKE_CURRENT_BINARY_DIR}/lang")
+
foreach(i ${opentrack_all-translations})
set(t "${CMAKE_CURRENT_SOURCE_DIR}/lang/${i}.ts")
- set(t2 "${CMAKE_CURRENT_BINARY_DIR}/lang/${i}.ts")
+ set(t2 "${i}.ts")
set(input "${${k}-all}")
if (NOT EXISTS "${t}")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lang")
@@ -28,27 +34,26 @@ function(otr_i18n_for_target_directory n)
-locations none
.
-ts "${t}"
- COMMAND "${CMAKE_COMMAND}" -E copy "${t}" "${t2}"
- DEPENDS "${input}" "${t}"
+ COMMAND "${CMAKE_COMMAND}" -E copy "${t}" "${CMAKE_CURRENT_BINARY_DIR}/${t2}"
+ DEPENDS "${k}" "${t}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Running lupdate for ${n}/${i}")
- set(target-name "i18n-lang-${i}-module-${n}")
+ set(target-name "i18n-lang-${i}-ts-${n}")
list(APPEND target-names "${target-name}")
add_custom_target(${target-name} DEPENDS "${t2}" COMMENT "")
- set_property(GLOBAL APPEND PROPERTY "opentrack-ts-files-${i}" "${t2}")
+ set_property(GLOBAL APPEND PROPERTY "opentrack-ts-files-${i}" "${CMAKE_CURRENT_BINARY_DIR}/${t2}")
set_property(GLOBAL APPEND PROPERTY "opentrack-ts-module-${n}" "${target-name}")
+ add_dependencies(i18n-lupdate "${target-name}")
endforeach()
- #add_custom_target("i18n-module-${n}" DEPENDS ${target-names})
endfunction()
function(otr_merge_translations)
otr_escape_string(i18n-pfx "${opentrack-i18n-pfx}")
install(CODE "file(REMOVE_RECURSE \"\${CMAKE_INSTALL_PREFIX}/${i18n-pfx}\")")
- get_property(all-modules GLOBAL PROPERTY opentrack-all-modules)
-
set(all-ts-targets "")
+ get_property(all-modules GLOBAL PROPERTY opentrack-all-modules)
foreach(target ${all-modules})
get_property(ts-targets GLOBAL PROPERTY "opentrack-ts-module-${target}")
list(APPEND all-ts-targets "${ts-targets}")
@@ -58,7 +63,7 @@ function(otr_merge_translations)
get_property(ts-files GLOBAL PROPERTY "opentrack-ts-files-${i}")
get_property(lrelease-binary TARGET "${Qt5_LRELEASE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION)
- set(qm-output "${CMAKE_CURRENT_BINARY_DIR}/${i}.qm")
+ set(qm-output "${i}.qm")
# whines about duplicate messages since tracker-pt-base is static
if(WIN32)
@@ -76,14 +81,15 @@ function(otr_merge_translations)
-qm "${qm-output}"
${to-null}
DEPENDS ${all-ts-targets}
- COMMENT "Running lrelease for ${i}")
+ COMMENT "Running lrelease for ${i}"
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
- add_custom_target("i18n-qm-${i}" DEPENDS "${qm-output}")
- add_dependencies(i18n "i18n-qm-${i}")
+ set(target-name "i18n-qm-${i}")
+ add_custom_target("${target-name}" DEPENDS "${qm-output}")
+ add_dependencies(i18n-lrelease "${target-name}")
- install(FILES "${qm-output}"
+ install(FILES "${CMAKE_BINARY_DIR}/${qm-output}"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${opentrack-i18n-pfx}"
PERMISSIONS ${opentrack-perms-file})
endforeach()
-
endfunction()