summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-28 12:56:15 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-03-28 13:52:38 +0200
commit6b7fb0200daaca00e6f54734af8a33470c7a4a6a (patch)
tree7c4b63cc0e7052705b2e755408aee50fba67fb04 /cmake
parent57c0f073ec38351aa659693cc16f6e3ab4ec28da (diff)
cmake: fix i18n target
Diffstat (limited to 'cmake')
-rw-r--r--cmake/opentrack-boilerplate.cmake33
-rw-r--r--cmake/opentrack-install.cmake26
2 files changed, 19 insertions, 40 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index 0b8b83c0..11559483 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -113,7 +113,7 @@ function(otr_module n)
message(FATAL_ERROR "otr_module bad formals: ${arg_UNPARSED_ARGUMENTS}")
endif()
- set(n_ "${n}")
+ set(n_orig "${n}")
set(n "opentrack-${n}")
project(${n})
@@ -197,33 +197,22 @@ function(otr_module n)
target_compile_definitions(${n} PRIVATE "STATIC_LIBRARY=1")
endif()
- set(langs "")
- foreach(i ${opentrack-all-translations})
- set(t "${CMAKE_CURRENT_SOURCE_DIR}/lang/${i}.ts")
- list(APPEND langs "${t}")
- endforeach()
-
set_property(GLOBAL APPEND PROPERTY opentrack-all-modules "${n}")
- set(ts-deps)
-
- foreach(i ${langs})
- set_property(GLOBAL PROPERTY "opentrack-ts-${i}" "")
- add_custom_command(OUTPUT "${i}"
+ foreach(i ${opentrack-all-translations})
+ set(t "${CMAKE_CURRENT_SOURCE_DIR}/lang/${i}.ts")
+ add_custom_command(OUTPUT "${t}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/lang"
- COMMAND "${Qt5_DIR}/../../../bin/lupdate" -silent -recursive -no-obsolete -locations relative . -ts "${i}"
+ COMMAND "${Qt5_DIR}/../../../bin/lupdate" -silent -recursive -no-obsolete -locations relative . -ts "${t}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
- DEPENDS ${${n}-c} ${${n}-rcc} ${${n}-uih}
- COMMENT "Running lupdate for ${i}"
- )
- list(APPEND ts-deps "${i}")
- get_property(tt GLOBAL PROPERTY "opentrack-ts-${i}")
- list(APPEND tt "${i}")
- set_property(GLOBAL PROPERTY "opentrack-ts-${i}" "${tt}")
+ DEPENDS ${${n}-c} ${${n}-ui} ${${n}-rc}
+ COMMENT "Running lupdate for ${n}/${i}")
+ set(target-name "i18n-lang-${i}-module-${n_orig}")
+ add_custom_target(${target-name} DEPENDS "${t}")
+ set_property(GLOBAL APPEND PROPERTY "opentrack-ts-targets-${i}" "${target-name}")
+ set_property(GLOBAL APPEND PROPERTY "opentrack-ts-files-${i}" "${t}")
endforeach()
- add_custom_target(i18n-module-${n} DEPENDS ${ts-deps})
-
if(NOT arg_NO-INSTALL)
set_property(GLOBAL APPEND PROPERTY opentrack-all-source-dirs "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake
index 92250bb2..b67ceb75 100644
--- a/cmake/opentrack-install.cmake
+++ b/cmake/opentrack-install.cmake
@@ -48,30 +48,20 @@ otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/OPENTRACK-LICENS
otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/AUTHORS.md")
function(merge_translations)
- set(all-deps "")
-
install(CODE "file(REMOVE_RECURSE \"\${CMAKE_INSTALL_PREFIX}/i18n\")")
- get_property(modules GLOBAL PROPERTY opentrack-all-modules)
-
foreach(i ${opentrack-all-translations})
- get_property(ts GLOBAL PROPERTY "opentrack-ts-${i}")
-
- set(deps "")
-
- foreach(k ${modules})
- list(APPEND deps "i18n-module-${k}")
- endforeach()
-
- set(qm-output "${CMAKE_BINARY_DIR}/${i}.qm")
+ get_property(ts-files GLOBAL PROPERTY "opentrack-ts-files-${i}")
+ get_property(ts-deps GLOBAL PROPERTY "opentrack-ts-targets-${i}")
- if("${ts}")
+ set(qm-output "${CMAKE_CURRENT_BINARY_DIR}/${i}.qm")
+ if(NOT ".${ts-files}" STREQUAL ".")
add_custom_command(OUTPUT "${qm-output}"
- COMMAND "${Qt5_DIR}/../../../bin/lrelease" -nounfinished -silent ${ts} -qm "${qm-output}"
- DEPENDS ${deps} ${ts}
+ COMMAND "${Qt5_DIR}/../../../bin/lrelease" -nounfinished -silent ${ts-files} -qm "${qm-output}"
+ DEPENDS ${ts-files}
COMMENT "Running lrelease for ${i}")
- add_custom_target(i18n-lang-${i} ALL DEPENDS "${qm-output}")
- list(APPEND all-deps "i18n-lang-${i}")
+ set(lang-target "i18n-lang-${i}")
+ list(APPEND all-deps "${qm-output}")
install(FILES "${qm-output}" DESTINATION "${opentrack-i18n-pfx}" RENAME "${i}.qm" ${opentrack-perms})
endif()
endforeach()