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 <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-06-04 00:10:40 -03:00 committed by Dirk Hohndel
parent 09ca240c3e
commit 537dcb15e0

View file

@ -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()