summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-04-07 17:49:10 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-04-07 16:27:39 -0700
commit6f935907053a6f2cc97b1fafed4a6896d40f6874 (patch)
tree93fe671600a3ffdd655c96f7442d3c3deb2761db
parent8b2ba50a629522b33ec69281ecf43fe5dc0dbedf (diff)
downloadsubsurface-6f935907053a6f2cc97b1fafed4a6896d40f6874.tar.gz
Add FindLibdivecomputer.cmake
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--CMakeLists.txt15
-rw-r--r--cmake/Modules/FindLibdivecomputer.cmake35
2 files changed, 36 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 329a5e19b..74accf273 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})
diff --git a/cmake/Modules/FindLibdivecomputer.cmake b/cmake/Modules/FindLibdivecomputer.cmake
new file mode 100644
index 000000000..07e36f21f
--- /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 )