Main Changes:

use Find{Marble, LIbdivecomputer, libgit}.cmake files, if a new library is
added in the future, just copy one of those and adapt.

defaults to looking for the library in the install/ directory created by
the build script

adapted the build script to use cmake

if a library is not found, it will stop the configuration and you can
specify the library manually


this will simplify the life of a few a bit:
From 87a04b7fc94e57337bec27d70cdaa9c9bf3e9f50 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 18:45:54 -0300
Subject: [PATCH 15/15] There's no need to search for a QMake now.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 scripts/build.sh | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/scripts/build.sh b/scripts/build.sh
index 12b6225..4675b23 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -19,20 +19,6 @@ if [[ ! -d "subsurface" ]] ; then
 	exit 1
 fi
 
-# qmake or qmake-qt5 ?
-qmake -v | grep "version 5" > /dev/null 2>&1
-if [[ $? -eq 0 ]] ; then
-	QMAKE=qmake
-else
-	qmake-qt5 -v | grep "version 5" > /dev/null 2>&1
-	if [[ $? -eq 0 ]] ; then
-		QMAKE=qmake-qt5
-	else
-		echo "can't find a working qmake for Qt5"
-		exit 1
-	fi
-fi
-
 mkdir -p install
 
 # build libgit2
-- 
2.3.5

From a03930237d2edc7fd69d1100477bee809fc9e6eb Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 18:43:38 -0300
Subject: [PATCH 14/15] Small adequations for building with the build-script: -
 libgit version bump to 0.22 ( 0.21.5 didn't worked here ) - do not search on
 compilation patches for libgit, libdivecomputer and marble - call cmake on
 build.sh instead of qmake.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 cmake/Modules/FindMarble.cmake | 4 ----
 scripts/build.sh               | 6 ++++--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/cmake/Modules/FindMarble.cmake b/cmake/Modules/FindMarble.cmake
index 141f0ad..4bc1846 100644
--- a/cmake/Modules/FindMarble.cmake
+++ b/cmake/Modules/FindMarble.cmake
@@ -17,8 +17,6 @@ FIND_PATH( MARBLE_INCLUDE_DIR
 NAMES marble/MarbleModel.h
 HINTS
     ${CMAKE_CURRENT_SOURCE_DIR}/../install/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/../marble/src/lib
-    ${CMAKE_CURRENT_SOURCE_DIR}/../marble-source/src/lib
     /usr/local/include
     /usr/include
 )
@@ -29,8 +27,6 @@ NAMES
     marblewidget
 HINTS
     ${CMAKE_CURRENT_SOURCE_DIR}/../install/lib
-    ${CMAKE_CURRENT_SOURCE_DIR}/../marble
-    ${CMAKE_CURRENT_SOURCE_DIR}/../marble-source
     /usr/local/include
     /usr/include
 )
diff --git a/scripts/build.sh b/scripts/build.sh
index 9ea0f4f..12b6225 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -45,7 +45,7 @@ if [ ! -d libgit2 ] ; then
 	fi
 fi
 cd libgit2
-git checkout v0.21.5
+git checkout v0.22.0
 mkdir -p build
 cd build
 cmake -DCMAKE_INSTALL_PREFIX=$SRC/install -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF ..
@@ -97,6 +97,8 @@ make -j4
 make install
 
 cd $SRC/subsurface
-$QMAKE CONFIG+=setRpath LIBDCDEVEL=1 LIBMARBLEDEVEL=$SRC/install SPECIAL_MARBLE_PREFIX=1 LIBGIT2DEVEL=$SRC/libgit2 subsurface.pro
+mkdir -p build
+cd build
+cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$SRC/install ..
 make -j4
 
-- 
2.3.5

From cc938b323d6a4a9655d4c9e36056c9b6f6ef4b52 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 18:26:43 -0300
Subject: [PATCH 13/15] Make it compilant with the build script.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 CMakeLists.txt                          | 4 ++++
 cmake/Modules/FindLIBGIT2.cmake         | 2 ++
 cmake/Modules/FindLibDiveComputer.cmake | 4 ++++
 cmake/Modules/FindMarble.cmake          | 3 +++
 4 files changed, 13 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53b7562..03e4b8a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,9 +39,13 @@ ELSE()
 ENDIF()
 
 FIND_PACKAGE(LibDiveComputer REQUIRED)
+INCLUDE_DIRECTORIES(${LIBDIVECOMPUTER_INCLUDE_DIR})
+
 FIND_PACKAGE(Marble REQUIRED)
 include_directories(${MARBLE_INCLUDE_DIR})
 
+SET(SUBSURFACE_LINK_LIBRARIES   ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES}  ${LIBGIT2_LIBRARIES} -lusb-1.0)
+
 # handle out of tree build correctly
 
 STRING(COMPARE EQUAL "${${PROJECT_NAME}_SOURCE_DIR}" "${${PROJECT_NAME}_BINARY_DIR}" insource)
diff --git a/cmake/Modules/FindLIBGIT2.cmake b/cmake/Modules/FindLIBGIT2.cmake
index 1a359ea..1a56482 100644
--- a/cmake/Modules/FindLIBGIT2.cmake
+++ b/cmake/Modules/FindLIBGIT2.cmake
@@ -16,6 +16,7 @@ ENDIF ()
 FIND_PATH( LIBGIT2_INCLUDE_DIR
 NAMES git2.h
 HINTS
+    ${CMAKE_CURRENT_SOURCE_DIR}/../install/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../libgit2/include
     /usr/local/include
     /usr/include
@@ -26,6 +27,7 @@ NAMES
     libgit2.a
     git2
 HINTS
+    ${CMAKE_CURRENT_SOURCE_DIR}/../install/lib
     ${CMAKE_CURRENT_SOURCE_DIR}/../libgit2/build
     /usr/local/include
     /usr/include
diff --git a/cmake/Modules/FindLibDiveComputer.cmake b/cmake/Modules/FindLibDiveComputer.cmake
index 602c225..cfe6b34 100644
--- a/cmake/Modules/FindLibDiveComputer.cmake
+++ b/cmake/Modules/FindLibDiveComputer.cmake
@@ -16,6 +16,7 @@ ENDIF ( LIBDIVECOMPUTER_INCLUDE_DIR AND LIBDIVECOMPUTER_LIBRARIES )
 FIND_PATH( LIBDIVECOMPUTER_INCLUDE_DIR
 NAMES libdivecomputer/hw.h
 HINTS
+    ${CMAKE_CURRENT_SOURCE_DIR}/../install/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../libdivecomputer/include/
     /usr/local/include
     /usr/include
@@ -26,6 +27,7 @@ NAMES
     libdivecomputer.a
     divecomputer
 HINTS
+    ${CMAKE_CURRENT_SOURCE_DIR}/../install/lib
     ${CMAKE_CURRENT_SOURCE_DIR}/../libdivecomputer/src/.libs/
     /usr/local/include
     /usr/include
@@ -33,3 +35,5 @@ HINTS
 
 INCLUDE( FindPackageHandleStandardArgs )
 FIND_PACKAGE_HANDLE_STANDARD_ARGS( LibDiveComputer DEFAULT_MSG LIBDIVECOMPUTER_INCLUDE_DIR LIBDIVECOMPUTER_LIBRARIES )
+
+
diff --git a/cmake/Modules/FindMarble.cmake b/cmake/Modules/FindMarble.cmake
index aed73ff..141f0ad 100644
--- a/cmake/Modules/FindMarble.cmake
+++ b/cmake/Modules/FindMarble.cmake
@@ -16,6 +16,7 @@ ENDIF ( MARBLE_INCLUDE_DIR AND MARBLE_LIBRARIES )
 FIND_PATH( MARBLE_INCLUDE_DIR
 NAMES marble/MarbleModel.h
 HINTS
+    ${CMAKE_CURRENT_SOURCE_DIR}/../install/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../marble/src/lib
     ${CMAKE_CURRENT_SOURCE_DIR}/../marble-source/src/lib
     /usr/local/include
@@ -27,6 +28,7 @@ NAMES
     ssrfmarblewidget
     marblewidget
 HINTS
+    ${CMAKE_CURRENT_SOURCE_DIR}/../install/lib
     ${CMAKE_CURRENT_SOURCE_DIR}/../marble
     ${CMAKE_CURRENT_SOURCE_DIR}/../marble-source
     /usr/local/include
@@ -35,3 +37,4 @@ HINTS
 
 INCLUDE( FindPackageHandleStandardArgs )
 FIND_PACKAGE_HANDLE_STANDARD_ARGS( marble DEFAULT_MSG MARBLE_INCLUDE_DIR MARBLE_LIBRARIES )
+MESSAGE( "MARBLE ACHADO ${MARBLE_INCLUDE_DIR}" )
\ No newline at end of file
-- 
2.3.5

From 4ddb47ebb29fc63af0769b18b2f2f15d1b3f77b4 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 17:55:52 -0300
Subject: [PATCH 12/15] Forgot to s/Marble/LIBGIT2

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 cmake/Modules/FindLIBGIT2.cmake | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmake/Modules/FindLIBGIT2.cmake b/cmake/Modules/FindLIBGIT2.cmake
index 0bc2813..1a359ea 100644
--- a/cmake/Modules/FindLIBGIT2.cmake
+++ b/cmake/Modules/FindLIBGIT2.cmake
@@ -1,8 +1,8 @@
-# - Try to find the Marble Library
+# - Try to find the LibGit2 Library
 # Once done this will define
 #
-#  LIBGIT2_FOUND - system has Marble
-#  LIBGIT2_INCLUDE_DIR - the Marble include directory
+#  LIBGIT2_FOUND - system has LibGit2
+#  LIBGIT2_INCLUDE_DIR - the LibGit2 include directory
 #  LIBGIT2_LIBRARIES
 # Redistribution and use is allowed according to the terms of the BSD license.
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
@@ -32,4 +32,4 @@ HINTS
 )
 
 INCLUDE( FindPackageHandleStandardArgs )
-FIND_PACKAGE_HANDLE_STANDARD_ARGS( git2 DEFAULT_MSG MARBLE_INCLUDE_DIR MARBLE_LIBRARIES )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS( git2 DEFAULT_MSG LIBGIT2_INCLUDE_DIR LIBGIT2_LIBRARIES )
-- 
2.3.5

From 521f9f64c49855eb31c1918146c201de4f5baa96 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 17:54:45 -0300
Subject: [PATCH 11/15] Added the FindLibdivecomputer.cmake

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 cmake/Modules/FindLibDiveComputer.cmake | 35 +++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 cmake/Modules/FindLibDiveComputer.cmake

diff --git a/cmake/Modules/FindLibDiveComputer.cmake b/cmake/Modules/FindLibDiveComputer.cmake
new file mode 100644
index 0000000..602c225
--- /dev/null
+++ b/cmake/Modules/FindLibDiveComputer.cmake
@@ -0,0 +1,35 @@
+# - Try to find the LIBDIVECOMPUTER Library
+# Once done this will define
+#
+#  LIBDIVECOMPUTER_FOUND - system has LIBDIVECOMPUTER
+#  LIBDIVECOMPUTER_INCLUDE_DIR - the LIBDIVECOMPUTER include directory
+#  LIBDIVECOMPUTER_LIBRARIES
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+# in cache already
+IF ( LIBDIVECOMPUTER_INCLUDE_DIR AND LIBDIVECOMPUTER_LIBRARIES )
+   SET( LIBDIVECOMPUTER_FIND_QUIETLY TRUE )
+ENDIF ( LIBDIVECOMPUTER_INCLUDE_DIR AND LIBDIVECOMPUTER_LIBRARIES )
+
+FIND_PATH( LIBDIVECOMPUTER_INCLUDE_DIR
+NAMES libdivecomputer/hw.h
+HINTS
+    ${CMAKE_CURRENT_SOURCE_DIR}/../libdivecomputer/include/
+    /usr/local/include
+    /usr/include
+)
+
+FIND_LIBRARY( LIBDIVECOMPUTER_LIBRARIES
+NAMES
+    libdivecomputer.a
+    divecomputer
+HINTS
+    ${CMAKE_CURRENT_SOURCE_DIR}/../libdivecomputer/src/.libs/
+    /usr/local/include
+    /usr/include
+)
+
+INCLUDE( FindPackageHandleStandardArgs )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS( LibDiveComputer DEFAULT_MSG LIBDIVECOMPUTER_INCLUDE_DIR LIBDIVECOMPUTER_LIBRARIES )
-- 
2.3.5

From af4bf094ac24cc16fe9df1d8863213e6401e2757 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 17:49:10 -0300
Subject: [PATCH 10/15] We will use FindLibdivecomputer.cmake to deal with
 that.

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 329a5e1..53b7562 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,20 +38,7 @@ ELSE()
 	INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDE_DIRS})
 ENDIF()
 
-SET(LIBDCDEVEL "" CACHE STRING "libraries")
-IF(DEFINED LIBDCDEVEL)
-	cmake_policy(SET CMP0015 OLD)
-	include_directories(${LIBDCDEVEL}/include )
-	link_directories(${LIBDCDEVEL}/src/.libs)
-	if(NOT DEFINED LIBDCSTATIC)
-		set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -ldivecomputer -lusb-1.0)
-	ELSE()
-		set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} libdivecomputer.a -lusb-1.0)
-	ENDIF()
-ELSE()
-	set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -ldivecomputer)
-ENDIF()
-
+FIND_PACKAGE(LibDiveComputer REQUIRED)
 FIND_PACKAGE(Marble REQUIRED)
 include_directories(${MARBLE_INCLUDE_DIR})
 
-- 
2.3.5

From 65be0d4feff70dd02ac1729a0a2a6390b2a7a796 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 17:46:07 -0300
Subject: [PATCH 09/15] Added a FindLIBGIT based on our findMarble.

It currently searches for the .a ( preferred ) or the .so
in the following directories, in order: ${CMAKE_CURRENT_SOURCE_DIR}/../libgit,
/usr/local and /usr.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 cmake/Modules/FindLIBGIT2.cmake | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 cmake/Modules/FindLIBGIT2.cmake

diff --git a/cmake/Modules/FindLIBGIT2.cmake b/cmake/Modules/FindLIBGIT2.cmake
new file mode 100644
index 0000000..0bc2813
--- /dev/null
+++ b/cmake/Modules/FindLIBGIT2.cmake
@@ -0,0 +1,35 @@
+# - Try to find the Marble Library
+# Once done this will define
+#
+#  LIBGIT2_FOUND - system has Marble
+#  LIBGIT2_INCLUDE_DIR - the Marble include directory
+#  LIBGIT2_LIBRARIES
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+# in cache already
+IF ( LIBGIT2_INCLUDE_DIR AND LIBGIT2_LIBRARIES )
+   SET( LIBGIT2_FIND_QUIETLY TRUE )
+ENDIF ()
+
+FIND_PATH( LIBGIT2_INCLUDE_DIR
+NAMES git2.h
+HINTS
+    ${CMAKE_CURRENT_SOURCE_DIR}/../libgit2/include
+    /usr/local/include
+    /usr/include
+)
+
+FIND_LIBRARY( LIBGIT2_LIBRARIES
+NAMES
+    libgit2.a
+    git2
+HINTS
+    ${CMAKE_CURRENT_SOURCE_DIR}/../libgit2/build
+    /usr/local/include
+    /usr/include
+)
+
+INCLUDE( FindPackageHandleStandardArgs )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS( git2 DEFAULT_MSG MARBLE_INCLUDE_DIR MARBLE_LIBRARIES )
-- 
2.3.5

From 877790fcf7f3b380205c97fe4c603a7c38bac4d1 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 17:38:08 -0300
Subject: [PATCH 08/15] Simplify libgit handling on main CMakeLists.txt

We will use the OPTIONS variable to decide to find the
.a or the .so, so there's no need to do checks here.

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f22091f..329a5e1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,13 +34,8 @@ pkg_config_library(LIBZIP libzip)
 if(NOT ${PREFER_GIT_FROMSOURCE})
 	pkg_config_library(LIBGIT2 libgit2)
 ELSE()
-	include_directories(${LIBGIT2DEVEL}/include)
-	link_directories(${LIBGIT2DEVEL}/build)
-	if(NOT DEFINED LIBGIT2STATIC)
-		set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lgit2 -lssl -lcrypto)
-	ELSE()
-		set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} libgit2.a -lssl -lcrypto)
-	ENDIF()
+	FIND_PACKAGE(LIBGIT2 REQUIRED)
+	INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDE_DIRS})
 ENDIF()
 
 SET(LIBDCDEVEL "" CACHE STRING "libraries")
-- 
2.3.5

From 57a24df2b06033b2bfeade2af1a37546cd8836f3 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 17:31:19 -0300
Subject: [PATCH 07/15] More two options that will be used in the future: use
 static/dynamic lib

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ac3e29..f22091f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,8 @@ 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

From 7c2f2ac35411ff37b14cd8477c504510861640d3 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 17:29:35 -0300
Subject: [PATCH 06/15] Added an option to toogle between distro and ours
 libgit.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b434f5..9ac3e29 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,8 @@ 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)
+
 SET(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules)
 INCLUDE_DIRECTORIES( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} qt-ui qt-ui/profile)
 
@@ -27,7 +29,7 @@ pkg_config_library(LIBZIP libzip)
 
 # more libraries with special handling in case we build them ourselves
 
-if(NOT DEFINED LIBGIT2DEVEL)
+if(NOT ${PREFER_GIT_FROMSOURCE})
 	pkg_config_library(LIBGIT2 libgit2)
 ELSE()
 	include_directories(${LIBGIT2DEVEL}/include)
-- 
2.3.5

From 4eb520398f2615861f6bc56cc1690f8f0dac5abe Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 17:20:27 -0300
Subject: [PATCH 05/15] No need to specify Marble dir anymore

Now we are already looking for the default directory.
*if* cmake doesn't finds automatically, the user needs
to specify -DMARBLE_INCLUDE_DIR and -DMARBLE_LIBRARIES

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ba2d33..4b434f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,15 +53,8 @@ ELSE()
 	set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -ldivecomputer)
 ENDIF()
 
-IF(NOT DEFINED LIBMARBLEDEVEL)
-	FIND_PACKAGE(Marble REQUIRED)
-	include_directories(${MARBLE_INCLUDE_DIR})
-	link_directories(${MARBLE_LIB_DIR})
-ELSE()
-	include_directories(${LIBMARBLEDEVEL}/include)
-	link_directories(${LIBMARBLEDEVEL}/lib)
-	SET(MARBLE_LIBRARIES -L${LIBMARBLEDEVEL}/lib -lssrfmarblewidget)
-ENDIF()
+FIND_PACKAGE(Marble REQUIRED)
+include_directories(${MARBLE_INCLUDE_DIR})
 
 # handle out of tree build correctly
 
-- 
2.3.5

From bcd7f3808df6864492085a627177e8e91d0f9e8b Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 17:19:14 -0300
Subject: [PATCH 04/15] Search marble in the default build folder

Now we search marble in the default build folder
too, wich is the CMAKE_CURRENT_SOURCE_DIR/..

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 cmake/Modules/FindMarble.cmake | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/cmake/Modules/FindMarble.cmake b/cmake/Modules/FindMarble.cmake
index 4917c99..aed73ff 100644
--- a/cmake/Modules/FindMarble.cmake
+++ b/cmake/Modules/FindMarble.cmake
@@ -8,13 +8,30 @@
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 #
 
+# in cache already
 IF ( MARBLE_INCLUDE_DIR AND MARBLE_LIBRARIES )
-   # in cache already
    SET( MARBLE_FIND_QUIETLY TRUE )
 ENDIF ( MARBLE_INCLUDE_DIR AND MARBLE_LIBRARIES )
 
-FIND_PATH( MARBLE_INCLUDE_DIR NAMES marble/MarbleModel.h )
-FIND_LIBRARY( MARBLE_LIBRARIES NAMES marblewidget )
+FIND_PATH( MARBLE_INCLUDE_DIR
+NAMES marble/MarbleModel.h
+HINTS
+    ${CMAKE_CURRENT_SOURCE_DIR}/../marble/src/lib
+    ${CMAKE_CURRENT_SOURCE_DIR}/../marble-source/src/lib
+    /usr/local/include
+    /usr/include
+)
+
+FIND_LIBRARY( MARBLE_LIBRARIES
+NAMES
+    ssrfmarblewidget
+    marblewidget
+HINTS
+    ${CMAKE_CURRENT_SOURCE_DIR}/../marble
+    ${CMAKE_CURRENT_SOURCE_DIR}/../marble-source
+    /usr/local/include
+    /usr/include
+)
 
 INCLUDE( FindPackageHandleStandardArgs )
 FIND_PACKAGE_HANDLE_STANDARD_ARGS( marble DEFAULT_MSG MARBLE_INCLUDE_DIR MARBLE_LIBRARIES )
-- 
2.3.5

From 59af44dea27173157e2542b7afa4445a30a6bdc7 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 16:53:28 -0300
Subject: [PATCH 03/15] Moved the Pkg Config macro to it's own file.

PKG_CONFIG macro was a helper macro and was generating
noise on the main CMakeLists.txt file, moved it to another file.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 CMakeLists.txt                       | 10 +---------
 cmake/Modules/pkgconfig_helper.cmake |  7 +++++++
 2 files changed, 8 insertions(+), 9 deletions(-)
 create mode 100644 cmake/Modules/pkgconfig_helper.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 381532c..4ba2d33 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,16 +17,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
 endif()
 
 # pkgconfig for required libraries
-
 FIND_PACKAGE(PkgConfig)
-
-MACRO(pkg_config_library LIBNAME pcfile)
-	pkg_check_modules(${LIBNAME} REQUIRED ${pcfile})
-	include_directories(${${LIBNAME}_INCLUDE_DIRS})
-	link_directories(${${LIBNAME}_LIBRARY_DIRS})
-	add_definitions(${${LIBNAME}_CFLAGS_OTHER})
-	set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${${LIBNAME}_LIBRARIES})
-ENDMACRO()
+INCLUDE(cmake/Modules/pkgconfig_helper.cmake)
 
 pkg_config_library(LIBXML libxml-2.0)
 pkg_config_library(LIBSQLITE3 sqlite3)
diff --git a/cmake/Modules/pkgconfig_helper.cmake b/cmake/Modules/pkgconfig_helper.cmake
new file mode 100644
index 0000000..afb5238
--- /dev/null
+++ b/cmake/Modules/pkgconfig_helper.cmake
@@ -0,0 +1,7 @@
+MACRO(pkg_config_library LIBNAME pcfile)
+	pkg_check_modules(${LIBNAME} REQUIRED ${pcfile})
+	include_directories(${${LIBNAME}_INCLUDE_DIRS})
+	link_directories(${${LIBNAME}_LIBRARY_DIRS})
+	add_definitions(${${LIBNAME}_CFLAGS_OTHER})
+	set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${${LIBNAME}_LIBRARIES})
+ENDMACRO()
-- 
2.3.5

From f14587472a45a4f88c6aacff364e57331a60dff5 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 16:44:49 -0300
Subject: [PATCH 02/15] FindMarble moved to cmake/Modules

This is the correct way to deal with CMake Modules
( or at least, the default way ). All our custom CMakeFiles
will be here.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 CMakeLists.txt                 |  2 +-
 cmake/Modules/FindMarble.cmake | 20 ++++++++++++++++++++
 marbledata/FindMarble.cmake    | 20 --------------------
 3 files changed, 21 insertions(+), 21 deletions(-)
 create mode 100644 cmake/Modules/FindMarble.cmake
 delete mode 100644 marbledata/FindMarble.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 95568f7..381532c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 2.8.11)
 
 SET(CMAKE_AUTOMOC ON)
 SET(CMAKE_AUTOUIC ON)
-SET(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/marbledata)
+SET(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules)
 INCLUDE_DIRECTORIES( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} qt-ui qt-ui/profile)
 
 # compiler specific settings
diff --git a/cmake/Modules/FindMarble.cmake b/cmake/Modules/FindMarble.cmake
new file mode 100644
index 0000000..4917c99
--- /dev/null
+++ b/cmake/Modules/FindMarble.cmake
@@ -0,0 +1,20 @@
+# - Try to find the Marble Library
+# Once done this will define
+#
+#  MARBLE_FOUND - system has Marble
+#  MARBLE_INCLUDE_DIR - the Marble include directory
+#  MARBLE_LIBRARIES
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+IF ( MARBLE_INCLUDE_DIR AND MARBLE_LIBRARIES )
+   # in cache already
+   SET( MARBLE_FIND_QUIETLY TRUE )
+ENDIF ( MARBLE_INCLUDE_DIR AND MARBLE_LIBRARIES )
+
+FIND_PATH( MARBLE_INCLUDE_DIR NAMES marble/MarbleModel.h )
+FIND_LIBRARY( MARBLE_LIBRARIES NAMES marblewidget )
+
+INCLUDE( FindPackageHandleStandardArgs )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS( marble DEFAULT_MSG MARBLE_INCLUDE_DIR MARBLE_LIBRARIES )
diff --git a/marbledata/FindMarble.cmake b/marbledata/FindMarble.cmake
deleted file mode 100644
index 4917c99..0000000
--- a/marbledata/FindMarble.cmake
+++ /dev/null
@@ -1,20 +0,0 @@
-# - Try to find the Marble Library
-# Once done this will define
-#
-#  MARBLE_FOUND - system has Marble
-#  MARBLE_INCLUDE_DIR - the Marble include directory
-#  MARBLE_LIBRARIES
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-#
-
-IF ( MARBLE_INCLUDE_DIR AND MARBLE_LIBRARIES )
-   # in cache already
-   SET( MARBLE_FIND_QUIETLY TRUE )
-ENDIF ( MARBLE_INCLUDE_DIR AND MARBLE_LIBRARIES )
-
-FIND_PATH( MARBLE_INCLUDE_DIR NAMES marble/MarbleModel.h )
-FIND_LIBRARY( MARBLE_LIBRARIES NAMES marblewidget )
-
-INCLUDE( FindPackageHandleStandardArgs )
-FIND_PACKAGE_HANDLE_STANDARD_ARGS( marble DEFAULT_MSG MARBLE_INCLUDE_DIR MARBLE_LIBRARIES )
-- 
2.3.5

From 5d2b8351ea3621724519786568145c1b9ce5faae Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 7 Apr 2015 16:41:50 -0300
Subject: [PATCH 01/15] Simplify Finding Qt

Qt5 Supports Components, wich means that we can list the
components we need to find, instead of specifying one for
each line.

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 09cd20b..95568f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,14 +82,7 @@ ENDIF()
 
 #configure Qt.
 
-FIND_PACKAGE(Qt5Core REQUIRED)
-FIND_PACKAGE(Qt5Concurrent REQUIRED)
-FIND_PACKAGE(Qt5Widgets REQUIRED)
-FIND_PACKAGE(Qt5Network REQUIRED)
-FIND_PACKAGE(Qt5WebKitWidgets REQUIRED)
-FIND_PACKAGE(Qt5PrintSupport REQUIRED)
-FIND_PACKAGE(Qt5Svg REQUIRED)
-FIND_PACKAGE(Qt5Test REQUIRED)
+FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network WebKitWidgets PrintSupport Svg Test)
 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)
 
-- 
2.3.5

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

Reply via email to