From 537dcb15e093a32f0588f3e4059a4d23e86f9bae Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 4 Jun 2015 00:10:40 -0300 Subject: [PATCH] Use CMake to find libssh2 This works on my system, I hope I don't break others. Another possibility is to pass -libssh2 directly if it's NOTFOUND. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 93d5262d2..5faee5291 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,12 @@ option(NO_TESTS "disable the tests" OFF) option(NO_DOCS "disable the docs" OFF) option(USE_LIBGIT23_API "allow building with libgit2 master" OFF) -set(CMAKE_MODULE_PATH ${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules) +set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} + ${${PROJECT_NAME}_SOURCE_DIR}/cmake/Modules + ${${PROJECT_NAME}_SOURCE_SIR}/../install-root/lib/cmake/libssh2 +) + include_directories(. ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} @@ -54,7 +59,8 @@ else() if(USE_LIBGIT23_API) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBGIT23_API") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LIBGIT23_API") - set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} -lssh2) + find_package(libssh2 REQUIRED) + set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARIES} ${LIBSSH2_LIBRARIES}) endif() endif()