2015-04-07 20:46:07 +00:00
|
|
|
# - 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
|
2015-04-09 22:00:52 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../install-root/include
|
2015-04-07 20:46:07 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../libgit2/include
|
|
|
|
/usr/local/include
|
|
|
|
/usr/include
|
|
|
|
)
|
|
|
|
|
2017-01-16 23:56:56 +00:00
|
|
|
IF ( LIBGIT2_DYNAMIC )
|
|
|
|
SET( LIBGIT2_SO libgit2.so )
|
|
|
|
ENDIF()
|
|
|
|
|
2015-04-07 20:46:07 +00:00
|
|
|
FIND_LIBRARY( LIBGIT2_LIBRARIES
|
|
|
|
NAMES
|
2017-01-16 23:56:56 +00:00
|
|
|
${LIBGIT2_SO}
|
2015-04-07 20:46:07 +00:00
|
|
|
libgit2.a
|
|
|
|
git2
|
|
|
|
HINTS
|
2015-04-09 22:00:52 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../install-root/lib
|
2015-04-07 20:46:07 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../libgit2/build
|
|
|
|
/usr/local/include
|
|
|
|
/usr/include
|
|
|
|
)
|
2017-10-23 15:47:33 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
SET(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES})
|
|
|
|
else()
|
|
|
|
SET(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} -lssl -lcrypto)
|
|
|
|
endif()
|
2015-04-07 20:46:07 +00:00
|
|
|
|
|
|
|
INCLUDE( FindPackageHandleStandardArgs )
|
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS( git2 DEFAULT_MSG LIBGIT2_INCLUDE_DIR LIBGIT2_LIBRARIES )
|
2017-01-16 23:56:56 +00:00
|
|
|
include_directories(${LIBGIT2_INCLUDE_DIR}})
|