This should work dirk,
If you apply and it doesn't works, try to remove the CMakeCache file and
run cmake again.
From 4dc637108442566bdc0781205ba254bc9f4db574 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 9 Apr 2015 15:06:47 -0300
Subject: [PATCH 2/2] 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 <[email protected]>
---
 CMakeLists.txt | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 35a2d8b..44fb7f2 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)
-- 
2.3.5

From d77fb03a8d9fb43de310bde559f5ccc96ca7fdfd Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 9 Apr 2015 14:18:30 -0300
Subject: [PATCH 1/2] We use static library if we find - option was not being
 used.

Currently we search for a static library and if we don't
find it, we search for a shared library. If one of them
is found, we return success but if none of them is found,
error. So - A static library for libgit and libdivecomputer
is preferred over the shared one.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 CMakeLists.txt | 2 --
 1 file changed, 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b53a555..35a2d8b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,8 +8,6 @@ cmake_minimum_required(VERSION 2.8.11)
 SET(CMAKE_AUTOMOC ON)
 SET(CMAKE_AUTOUIC ON)
 OPTION(PREFER_GIT_FROMSOURCE "Turn off if you wanna use system's libgit 0.21.5" ON)
-OPTION(PREFER_GIT_STATIC "Turn off if you wanna use a shared library" ON)
-OPTION(PREFER_LIBDC_STATIC "Turn off if you wanna use a shared library" ON)
 
 SET(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules)
 INCLUDE_DIRECTORIES( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} qt-ui qt-ui/profile)
-- 
2.3.5

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to