Commit 62d66a4ac52127cd4e9780c3a2dd321da4ae2e46

Edward Thomson 2014-12-22T10:22:03

Merge pull request #2745 from libgit2/cmn/pkg-config-ssh Find libssh2 via pkg-config

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 89dce45..c06026b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -212,7 +212,7 @@ ENDIF()
 
 # Optional external dependency: libssh2
 IF (USE_SSH)
-	FIND_PACKAGE(LIBSSH2)
+	PKG_CHECK_MODULES(LIBSSH2 libssh2)
 ENDIF()
 IF (LIBSSH2_FOUND)
 	ADD_DEFINITIONS(-DGIT_SSH)
diff --git a/cmake/Modules/FindLIBSSH2.cmake b/cmake/Modules/FindLIBSSH2.cmake
deleted file mode 100644
index 6347d60..0000000
--- a/cmake/Modules/FindLIBSSH2.cmake
+++ /dev/null
@@ -1,44 +0,0 @@
-if (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
-  set(LIBSSH2_FOUND TRUE)
-else (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
-  find_path(LIBSSH2_INCLUDE_DIR
-    NAMES
-      libssh2.h
-    PATHS
-      /usr/include
-      /usr/local/include
-      /opt/local/include
-      /sw/include
-      ${CMAKE_INCLUDE_PATH}
-      ${CMAKE_INSTALL_PREFIX}/include
-  )
-  
-  find_library(LIBSSH2_LIBRARY
-    NAMES
-      ssh2
-      libssh2
-    PATHS
-      /usr/lib
-      /usr/local/lib
-      /opt/local/lib
-      /sw/lib
-      ${CMAKE_LIBRARY_PATH}
-      ${CMAKE_INSTALL_PREFIX}/lib
-  )
-
-  if (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
-    set(LIBSSH2_FOUND TRUE)
-  endif (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
-
-  if (LIBSSH2_FOUND)
-    set(LIBSSH2_INCLUDE_DIRS
-      ${LIBSSH2_INCLUDE_DIR}
-    )
-
-    set(LIBSSH2_LIBRARIES
-      ${LIBSSH2_LIBRARIES}
-      ${LIBSSH2_LIBRARY}
-    )
-  endif (LIBSSH2_FOUND)
-endif (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
-