summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-04-18 00:31:12 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-04-17 15:25:47 -0700
commited4fbb92d015dac03ecc47b3a377da1f54a1ec7c (patch)
tree6adfa8f383453b7e2d5d6f6c130b6b1fef0954ee /CMakeLists.txt
parent39d0b5533d9dc03257181ee6796e51f370605656 (diff)
downloadsubsurface-ed4fbb92d015dac03ecc47b3a377da1f54a1ec7c.tar.gz
cmake: add LIBGIT2_FROM_PKGCONFIG and LIBDC_FROM_PKGCONFIG
These two new options allow usage of pkg-config to retrieve libdivecomputer and libgit2. For some reason the variables *_LIBRARIES have to be set to blank strings in the process, otherwise "-l" is passed to the linker. LIBGIT2_FROM_PKGCONFIG is a rename from PREFER_GIT_FROMSOURCE for consistency. The IF() check is also fixed. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt15
1 files changed, 11 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d766caec1..21a9616ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +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)
+OPTION(LIBGIT2_FROM_PKGCONFIG "use pkg-config to retrieve libgit2" OFF)
+OPTION(LIBDC_FROM_PKGCONFIG "use pkg-config to retrieve libdivecomputer" OFF)
OPTION(NO_MARBLE "disable the marble widget" OFF)
OPTION(NO_TESTS "disable the tests" OFF)
OPTION(NO_DOCS "disable the docs" OFF)
@@ -33,15 +34,21 @@ pkg_config_library(LIBUSB libusb-1.0 QUIET)
# more libraries with special handling in case we build them ourselves
-if(NOT ${PREFER_GIT_FROMSOURCE})
+IF(LIBGIT2_FROM_PKGCONFIG)
pkg_config_library(LIBGIT2 libgit2 REQUIRED)
+ SET(LIBGIT2_LIBRARIES "")
ELSE()
FIND_PACKAGE(LIBGIT2 REQUIRED)
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDE_DIR})
ENDIF()
-FIND_PACKAGE(Libdivecomputer REQUIRED)
-INCLUDE_DIRECTORIES(${LIBDIVECOMPUTER_INCLUDE_DIR})
+IF(LIBDC_FROM_PKGCONFIG)
+ pkg_config_library(LIBDC libdivecomputer REQUIRED)
+ SET(LIBDIVECOMPUTER_LIBRARIES "")
+ELSE()
+ FIND_PACKAGE(Libdivecomputer REQUIRED)
+ INCLUDE_DIRECTORIES(${LIBDIVECOMPUTER_INCLUDE_DIR})
+ENDIF()
# optional marble