Hi,

Linux distributions usually require to use system libraries instead of
ones bundled with software projects like QLandkarte. See the attached
patch that enables the use of system QtSoap library in Fedora >= 16


With regards

Dan

>From a918b49bdcdba8219c593183a588e7076a3be0f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <[email protected]>
Date: Wed, 29 Aug 2012 14:22:50 +0200
Subject: [PATCH] allow using system QtSoap library

---
 CMakeLists.txt                 |    3 ++
 cmake/Modules/FindQtSoap.cmake |   73 ++++++++++++++++++++++++++++++++++++++++
 src/CMakeLists.txt             |    9 ++++-
 3 files changed, 83 insertions(+), 2 deletions(-)
 create mode 100644 cmake/Modules/FindQtSoap.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c065a81..fed2c24 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,7 +71,10 @@ add_subdirectory(3rdparty/getopt)
 add_subdirectory(3rdparty/map2gcm)
 add_subdirectory(3rdparty/map2rmap)
 add_subdirectory(3rdparty/cache2gtiff)
+find_package(QtSoap)
+if (NOT QTSOAP_FOUND)
 add_subdirectory(3rdparty/qtsoap)
+endif()
 
 if(WITH_PROFILING)
 add_definitions(-DDO_PROFILING)
diff --git a/cmake/Modules/FindQtSoap.cmake b/cmake/Modules/FindQtSoap.cmake
new file mode 100644
index 0000000..853d530
--- /dev/null
+++ b/cmake/Modules/FindQtSoap.cmake
@@ -0,0 +1,73 @@
+# - Try to find QtSoap
+# Once done this will define
+#
+#  QTSOAP_FOUND - system has QTSOAP
+#  QTSOAP_INCLUDE_DIRS - the QTSOAP include directory
+#  QTSOAP_LIBRARIES - Link these to use QTSOAP
+#  QTSOAP_DEFINITIONS - Compiler switches required for using QTSOAP
+#
+#  Copyright (c) 2006 Andreas Schneider <[email protected]>
+#  updated for QtSoap by Dan Horák
+#
+#  Redistribution and use is allowed according to the terms of the New
+#  BSD license.
+#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+
+if (QTSOAP_LIBRARIES AND QTSOAP_INCLUDE_DIRS)
+  # in cache already
+  set(QTSOAP_FOUND TRUE)
+else (QTSOAP_LIBRARIES AND QTSOAP_INCLUDE_DIRS)
+  find_path(QTSOAP_INCLUDE_DIRS
+    NAMES
+      qtsoap.h
+    PATHS
+        /usr/include
+        /usr/local/include
+        /opt/local/include
+        /sw/include
+        /usr/include/QtSoap
+        /usr/local/include/QtSoap
+        /opt/local/include/QtSoap
+        /sw/include/QtSoap
+  )
+
+  # debian uses version suffixes
+  # add suffix evey new release
+  find_library(QTSOAP_LIBRARIES
+    NAMES
+        qtsoap
+    PATHS
+      /usr/lib64
+      /usr/lib
+      /usr/local/lib
+      /opt/local/lib
+      /sw/lib
+  )
+
+  if (QTSOAP_INCLUDE_DIRS AND QTSOAP_LIBRARIES)
+     set(QTSOAP_FOUND TRUE)
+  endif (QTSOAP_INCLUDE_DIRS AND QTSOAP_LIBRARIES)
+
+  if (QTSOAP_FOUND)
+    if (NOT QTSOAP_FIND_QUIETLY)
+      message(STATUS "Found QtSoap: ${QTSOAP_LIBRARIES}")
+    endif (NOT QTSOAP_FIND_QUIETLY)
+  else (QTSOAP_FOUND)
+    if (QTSOAP_FIND_REQUIRED)
+      message(FATAL_ERROR "Could not find QtSoap")
+    endif (QTSOAP_FIND_REQUIRED)
+  endif (QTSOAP_FOUND)
+
+  # show the QTSOAP_INCLUDE_DIRS and QTSOAP_LIBRARIES variables only in the advanced view
+  mark_as_advanced(QTSOAP_INCLUDE_DIRS QTSOAP_LIBRARIES)
+
+endif (QTSOAP_LIBRARIES AND QTSOAP_INCLUDE_DIRS)
+
+if (WIN32)
+set(QTSOAP_FOUND FALSE)
+set(QTSOAP_LIBRARIES "")
+set(QTSOAP_INCLUDE_DIRS "")
+endif (WIN32)
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0ce3c3a..b6b3bb1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -538,6 +538,11 @@ else(EXIF_FOUND)
     set(DMTX_LIBRARIES "")
 ENDIF(DMTX_FOUND)
 
+IF(NOT QTSOAP_FOUND)
+    set(QTSOAP_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/3rdparty/qtsoap")
+    set(QTSOAP_LIBRARIES "qtsoap")
+ENDIF()
+
 
 add_definitions(-DDB_VERSION=8)
 SET(qlandkarte_HDRS ${qlandkarte_HDRS}  CGeoDB.h CDlgSelGeoDBFolder.h CDlgEditFolder.h)
@@ -630,8 +635,8 @@ include_directories(
   ${CMAKE_SOURCE_DIR}/3rdparty/QZip
   ${CMAKE_SOURCE_DIR}/3rdparty/QTextHtmlExporter
   ${CMAKE_SOURCE_DIR}/3rdparty/getopt
-  ${CMAKE_SOURCE_DIR}/3rdparty/qtsoap
   ${CMAKE_SOURCE_DIR}/3rdparty/conan/include
+  ${QTSOAP_INCLUDE_DIRS}
   ${EXIF_INCLUDE_DIRS}
   ${DMTX_INCLUDE_DIRS}
   ${GPSD_INCLUDE_DIRS}
@@ -705,7 +710,7 @@ target_link_libraries(
       qzip
       qtexthtmlexporter
       getopt
-      qtsoap
+      ${QTSOAP_LIBRARIES}
       ${PROFILING_LIBRARIES}
   )
 
-- 
1.7.7.6

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Qlandkartegt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qlandkartegt-users

Reply via email to