summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-04-07 17:46:07 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-04-07 16:27:34 -0700
commit8b2ba50a629522b33ec69281ecf43fe5dc0dbedf (patch)
treecc41f5abc5f6e694ba5333c0b75bc63331e603a0 /cmake
parent46990f4ac8840c26a5fda09b28b7b057f9b0e3b0 (diff)
downloadsubsurface-8b2ba50a629522b33ec69281ecf43fe5dc0dbedf.tar.gz
Add a FindLIBGIT2 based on our FindMarble.
It currently searches for the .a (preferred) or the .so in the following directories, in order: ${CMAKE_CURRENT_SOURCE_DIR}/../libgit2, /usr/local, and /usr. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/FindLIBGIT2.cmake36
1 files changed, 36 insertions, 0 deletions
diff --git a/cmake/Modules/FindLIBGIT2.cmake b/cmake/Modules/FindLIBGIT2.cmake
new file mode 100644
index 000000000..2d13f0bff
--- /dev/null
+++ b/cmake/Modules/FindLIBGIT2.cmake
@@ -0,0 +1,36 @@
+# - Try to find the LibGit2 Library
+# Once done this will define
+#
+# 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.
+#
+
+# 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
+)
+SET(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} -lssl -lcrypto)
+
+INCLUDE( FindPackageHandleStandardArgs )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS( git2 DEFAULT_MSG LIBGIT2_INCLUDE_DIR LIBGIT2_LIBRARIES )