summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xCMakeLists.txt3
-rw-r--r--cmake/opentrack-boilerplate.cmake24
-rw-r--r--cmake/opentrack-i18n.cmake54
-rw-r--r--cmake/opentrack-install.cmake33
4 files changed, 57 insertions, 57 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d478ea3..9b68b82c 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,7 @@ endif()
include(opentrack-word-size)
include(opentrack-hier)
include(opentrack-platform)
+include(opentrack-i18n)
include(opentrack-boilerplate)
include(opentrack-qt)
@@ -82,5 +83,5 @@ foreach(i ${opentrack-subprojects})
add_subdirectory(${i})
endforeach()
-merge_translations()
+otr_merge_translations()
install_sources()
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index f8c3eaa6..cc197657 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -98,7 +98,7 @@ function(otr_compat target)
set(l-props "-Wl,--as-needed")
endif()
- otr_prop(TARGET ${target} COMPILE_FLAGS "${c-props} ${arg_COMPILE}"
+ otr_prop(TARGET ${target} COMPIcLE_FLAGS "${c-props} ${arg_COMPILE}"
LINK_FLAGS "${l-props} ${arg_LINK}")
endfunction()
@@ -110,28 +110,6 @@ function(otr_install_pdb_current_project target)
endif()
endfunction()
-function(otr_i18n_for_target_directory n)
- set(k "opentrack-${n}")
-
- get_property(lupdate-binary TARGET "${Qt5_LUPDATE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION)
-
- foreach(i ${opentrack_all-translations})
- set(t "${CMAKE_CURRENT_SOURCE_DIR}/lang/${i}.ts")
- set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" PROPERTY CLEAN_NO_CUSTOM 1)
- if(NOT opentrack_disable-i18n-update)
- add_custom_command(OUTPUT "${t}"
- COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/lang"
- COMMAND "${lupdate-binary}" -silent -recursive -no-obsolete -locations relative . -ts "${t}"
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
- DEPENDS ${${k}-cc} ${${k}-hh} ${${k}-ui} ${${k}-rc}
- COMMENT "Running lupdate for ${n}/${i}")
- set(target-name "i18n-lang-${i}-module-${n}")
- add_custom_target(${target-name} DEPENDS "${t}")
- endif()
- set_property(GLOBAL APPEND PROPERTY "opentrack-ts-files-${i}" "${t}")
- endforeach()
-endfunction()
-
function(otr_module n_)
message(STATUS "module ${n_}")
cmake_parse_arguments(arg
diff --git a/cmake/opentrack-i18n.cmake b/cmake/opentrack-i18n.cmake
new file mode 100644
index 00000000..74d5dcee
--- /dev/null
+++ b/cmake/opentrack-i18n.cmake
@@ -0,0 +1,54 @@
+function(otr_i18n_for_target_directory n)
+ set(k "opentrack-${n}")
+
+ get_property(lupdate-binary TARGET "${Qt5_LUPDATE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION)
+
+ foreach(i ${opentrack_all-translations})
+ set(t "${CMAKE_CURRENT_SOURCE_DIR}/lang/${i}.ts")
+ set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" PROPERTY CLEAN_NO_CUSTOM 1)
+ if(NOT opentrack_disable-i18n-update)
+ add_custom_command(OUTPUT "${t}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/lang"
+ COMMAND "${lupdate-binary}" -silent -recursive -no-obsolete -locations relative . -ts "${t}"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ DEPENDS ${${k}-cc} ${${k}-hh} ${${k}-ui} ${${k}-rc}
+ COMMENT "Running lupdate for ${n}/${i}")
+ set(target-name "i18n-lang-${i}-module-${n}")
+ add_custom_target(${target-name} DEPENDS "${t}")
+ endif()
+ set_property(GLOBAL APPEND PROPERTY "opentrack-ts-files-${i}" "${t}")
+ endforeach()
+endfunction()
+
+function(otr_merge_translations)
+ install(CODE "file(REMOVE_RECURSE \"\${CMAKE_INSTALL_PREFIX}/i18n\")")
+
+ set(all-qm-files "")
+
+ foreach(i ${opentrack_all-translations})
+ get_property(ts-files GLOBAL PROPERTY "opentrack-ts-files-${i}")
+
+ set(ts-files_ "")
+
+ foreach(k ${ts-files})
+ if(EXISTS "${k}" OR NOT opentrack_disable-i18n-update)
+ list(APPEND ts-files_ "${k}")
+ endif()
+ endforeach()
+
+ get_property(lrelease-binary TARGET "${Qt5_LRELEASE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION)
+
+ if(NOT ".${ts-files_}" STREQUAL ".")
+ set(qm-output "${CMAKE_CURRENT_BINARY_DIR}/${i}.qm")
+ list(APPEND all-qm-files "${qm-output}")
+ add_custom_command(OUTPUT "${qm-output}"
+ COMMAND "${lrelease-binary}" -nounfinished -silent ${ts-files_} -qm "${qm-output}"
+ DEPENDS ${ts-files}
+ COMMENT "Running lrelease for ${i}")
+ set(lang-target "i18n-lang-${i}")
+ add_custom_target("${lang-target}" DEPENDS "${qm-output}")
+ install(FILES "${qm-output}" DESTINATION "${opentrack-i18n-pfx}" RENAME "${i}.qm" ${opentrack-perms})
+ endif()
+ endforeach()
+ add_custom_target(i18n ALL DEPENDS ${all-qm-files})
+endfunction()
diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake
index e867a3b7..1236d178 100644
--- a/cmake/opentrack-install.cmake
+++ b/cmake/opentrack-install.cmake
@@ -54,36 +54,3 @@ otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/AUTHORS.md")
set(opentrack_disable-i18n-update FALSE CACHE BOOL "")
-function(merge_translations)
- install(CODE "file(REMOVE_RECURSE \"\${CMAKE_INSTALL_PREFIX}/i18n\")")
-
- set(all-qm-files "")
-
- foreach(i ${opentrack_all-translations})
- get_property(ts-files GLOBAL PROPERTY "opentrack-ts-files-${i}")
-
- set(ts-files_ "")
-
- foreach(k ${ts-files})
- if(EXISTS "${k}" OR NOT opentrack_disable-i18n-update)
- list(APPEND ts-files_ "${k}")
- endif()
- endforeach()
-
- get_property(lrelease-binary TARGET "${Qt5_LRELEASE_EXECUTABLE}" PROPERTY IMPORTED_LOCATION)
-
- if(NOT ".${ts-files_}" STREQUAL ".")
- set(qm-output "${CMAKE_CURRENT_BINARY_DIR}/${i}.qm")
- list(APPEND all-qm-files "${qm-output}")
- add_custom_command(OUTPUT "${qm-output}"
- COMMAND "${lrelease-binary}" -nounfinished -silent ${ts-files_} -qm "${qm-output}"
- DEPENDS ${ts-files}
- COMMENT "Running lrelease for ${i}")
- set(lang-target "i18n-lang-${i}")
- add_custom_target("${lang-target}" DEPENDS "${qm-output}")
- install(FILES "${qm-output}" DESTINATION "${opentrack-i18n-pfx}" RENAME "${i}.qm" ${opentrack-perms})
- endif()
- endforeach()
- add_custom_target(i18n ALL DEPENDS ${all-qm-files})
-endfunction()
-