FindLibSSH2.cmake 777 B

12345678910111213141516171819202122
  1. # - Try to find the libssh2 library
  2. # Once done this will define
  3. #
  4. # LIBSSH2_FOUND - system has the libssh2 library
  5. # LIBSSH2_INCLUDE_DIR - the libssh2 include directory
  6. # LIBSSH2_LIBRARY - the libssh2 library name
  7. find_path(LIBSSH2_INCLUDE_DIR libssh2.h)
  8. find_library(LIBSSH2_LIBRARY NAMES ssh2 libssh2)
  9. if(LIBSSH2_INCLUDE_DIR)
  10. file(STRINGS "${LIBSSH2_INCLUDE_DIR}/libssh2.h" libssh2_version_str REGEX "^#define[\t ]+LIBSSH2_VERSION[\t ]+\"(.*)\"")
  11. string(REGEX REPLACE "^.*\"([^\"]+)\"" "\\1" LIBSSH2_VERSION "${libssh2_version_str}")
  12. endif()
  13. include(FindPackageHandleStandardArgs)
  14. find_package_handle_standard_args(LibSSH2
  15. REQUIRED_VARS LIBSSH2_LIBRARY LIBSSH2_INCLUDE_DIR
  16. VERSION_VAR LIBSSH2_VERSION)
  17. mark_as_advanced(LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY)