aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-04-09 15:06:47 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-04-09 11:16:44 -0700
commit1a662df648ef705ee82049adb6dba119ad9df0a8 (patch)
tree96e608e4afa0e4a41248771161d0164fe0769ac9
parenta56c0f227d3e8d73ba2721a3598e406e2ff1c4d8 (diff)
downloadsubsurface-1a662df648ef705ee82049adb6dba119ad9df0a8.tar.gz
Use Qt5Translations to deal with translations
And remove the old code that did the same thing in a very complex way. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--CMakeLists.txt18
1 files changed, 3 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 35a2d8b77..44fb7f278 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,7 +55,7 @@ ENDIF()
#configure Qt.
-FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network WebKitWidgets PrintSupport Svg Test)
+FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network WebKitWidgets PrintSupport Svg Test LinguistTools)
SET(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::WebKitWidgets Qt5::PrintSupport Qt5::Svg)
SET(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test)
@@ -357,7 +357,7 @@ set(DOCFILES
${CMAKE_BINARY_DIR}/Documentation/user-manual_ru.html
)
-set(TRANSLATION_SRC
+QT5_ADD_TRANSLATION(TRANSLATIONS
translations/subsurface_source.ts
translations/subsurface_bg_BG.ts
translations/subsurface_cs.ts
@@ -404,19 +404,7 @@ set(QTTRANSLATIONS_BASE
# translations/subsurface_hu.ts \
# translations/subsurface_ro_RO.ts \
-# if we apply the REGEX to TRANSLATION_SRC then the list of files turns
-# into a single string, so we assemble it file name by file name
-foreach(TRANSLATION ${TRANSLATION_SRC})
- string(REGEX REPLACE \\.ts .qm TRANSLATION_QM ${TRANSLATION})
- string(REGEX REPLACE "/" "-" TRANSLATION_TARGET ${TRANSLATION_QM})
- ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_BINARY_DIR}/${TRANSLATION_QM}
- COMMAND mkdir -p ${CMAKE_BINARY_DIR}/translations \\; ${LRELEASE} ${CMAKE_SOURCE_DIR}/${TRANSLATION} -qm ${CMAKE_BINARY_DIR}/${TRANSLATION_QM}
- DEPENDS ${TRANSLATION}
- )
- set(TRANSLATIONS ${TRANSLATIONS} ${CMAKE_BINARY_DIR}/${TRANSLATION_QM})
-endforeach()
-SET_SOURCE_FILES_PROPERTIES(main.cpp PROPERTIES OBJECT_DEPENDS "${TRANSLATIONS}")
+ADD_CUSTOM_TARGET (translations ALL DEPENDS ${TRANSLATIONS})
if(QT_TRANSLATION_DIR STREQUAL "")
set(QT_TRANSLATION_DIR ${Qt5Core_DIR}/../../../translations)