summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-12-08 05:46:25 +0100
committerStanislaw Halik <sthalik@misaki.pl>2016-12-08 05:46:25 +0100
commitd9d6a2e8e5276775acad7da4855f69e1fdc95d24 (patch)
tree053c1d87a9b7b0ca35b7a3f017f3d75347693092
parentcdcb32474a204074686654cfa824d8a82533dabf (diff)
cmake: fix translation generation
-rwxr-xr-xCMakeLists.txt1
-rw-r--r--cmake/opentrack-boilerplate.cmake25
-rw-r--r--cmake/opentrack-install.cmake10
3 files changed, 19 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5974403..bde3fead 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,7 @@ include(opentrack-hier)
include(opentrack-qt)
include(opentrack-platform)
include(opentrack-boilerplate)
+
include(opentrack-version)
include(opentrack-install)
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index 8d23ad19..82c277c5 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -215,23 +215,30 @@ function(opentrack_boilerplate n)
endif()
endif()
+ set(SDK_REGEN_TRANSLATIONS FALSE CACHE BOOL "Regenerate translation files on build")
+
set(langs "")
foreach(i ${opentrack-all-translations})
set(t "${CMAKE_CURRENT_SOURCE_DIR}/lang/${i}.ts")
- list(APPEND langs "${t}")
- get_property(tt GLOBAL PROPERTY opentrack-${i}-ts)
- set(tt ${tt} ${t})
- set_property(GLOBAL PROPERTY opentrack-${i}-ts ${tt})
+ if(SDK_REGEN_TRANSLATIONS OR NOT EXISTS t)
+ list(APPEND langs "${t}")
+ get_property(tt GLOBAL PROPERTY opentrack-${i}-ts)
+ set(tt ${tt} ${t})
+ set_property(GLOBAL PROPERTY opentrack-${i}-ts ${tt})
+ endif()
endforeach()
get_property(modules GLOBAL PROPERTY opentrack-all-modules)
list(APPEND modules "${n}")
set_property(GLOBAL PROPERTY opentrack-all-modules "${modules}")
- add_custom_target(${n}-i18n
- COMMAND cmake -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/lang"
- COMMAND "${Qt5_DIR}/../../../bin/lupdate" -silent -recursive -no-obsolete -locations relative . -ts ${langs}
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
- )
+ if(NOT langs STREQUAL "")
+ add_custom_target(i18n-module-${n}
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/lang"
+ COMMAND "${Qt5_DIR}/../../../bin/lupdate" -silent -recursive -no-obsolete -locations relative . -ts ${langs}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+ else()
+ add_custom_target(i18n-module-${n})
+ endif()
endfunction()
diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake
index ccbdd5ad..9fc280d6 100644
--- a/cmake/opentrack-install.cmake
+++ b/cmake/opentrack-install.cmake
@@ -62,7 +62,7 @@ function(merge_translations)
set(deps "")
foreach(k ${modules})
- list(APPEND deps "${k}-i18n")
+ list(APPEND deps "i18n-module-${k}")
endforeach()
add_custom_target(i18n-lang-${i}
@@ -72,12 +72,6 @@ function(merge_translations)
list(APPEND all-deps "i18n-lang-${i}")
install(FILES "${qm-output}" DESTINATION "${opentrack-i18n-pfx}" RENAME "${i}.qm" ${opentrack-perms})
endforeach()
- set(SDK_REGEN_TRANSLATIONS TRUE CACHE BOOL "Regenerate translation files on build")
- if(SDK_REGEN_TRANSLATIONS)
- set(param ALL)
- else()
- set(param "")
- endif()
- add_custom_target(i18n ${param} DEPENDS ${all-deps})
+ add_custom_target(i18n ALL DEPENDS ${all-deps})
endfunction()