Loading CMake/FindLibSSH2.cmake 0 → 100644 +35 −0 Original line number Diff line number Diff line # - Try to find the libssh2 library # Once done this will define # # LIBSSH2_FOUND - system has the libssh2 library # LIBSSH2_INCLUDE_DIR - the libssh2 include directory # LIBSSH2_LIBRARY - the libssh2 library name if (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY) set(LibSSH2_FIND_QUIETLY TRUE) endif (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY) FIND_PATH(LIBSSH2_INCLUDE_DIR libssh2.h ) FIND_LIBRARY(LIBSSH2_LIBRARY NAMES ssh2 ) if(LIBSSH2_INCLUDE_DIR) file(STRINGS "${LIBSSH2_INCLUDE_DIR}/libssh2.h" libssh2_version_str REGEX "^#define[\t ]+LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9][0-9][0-9][0-9][0-9].*") string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_MAJOR "${libssh2_version_str}") string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9]([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_MINOR "${libssh2_version_str}") string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9][0-9][0-9]([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_PATCH "${libssh2_version_str}") string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_MAJOR "${LIBSSH2_VERSION_MAJOR}") string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_MINOR "${LIBSSH2_VERSION_MINOR}") string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_PATCH "${LIBSSH2_VERSION_PATCH}") set(LIBSSH2_VERSION "${LIBSSH2_VERSION_MAJOR}.${LIBSSH2_VERSION_MINOR}.${LIBSSH2_VERSION_PATCH}") endif(LIBSSH2_INCLUDE_DIR) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibSSH2 DEFAULT_MSG LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY ) MARK_AS_ADVANCED(LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY LIBSSH2_VERSION_MAJOR LIBSSH2_VERSION_MINOR LIBSSH2_VERSION_PATCH LIBSSH2_VERSION) CMakeLists.txt +35 −3 Original line number Diff line number Diff line Loading @@ -289,11 +289,40 @@ if(CMAKE_USE_OPENSSL) endif(OPENSSL_FOUND) endif(CMAKE_USE_OPENSSL) #libSSH2 option(CMAKE_USE_LIBSSH2 "Use libSSH2" ON) mark_as_advanced(CMAKE_USE_LIBSSH2) set(USE_LIBSSH2 OFF) set(HAVE_LIBSSH2 OFF) if(CMAKE_USE_LIBSSH2) find_package(LibSSH2) if(LIBSSH2_FOUND) list(APPEND CURL_LIBS ${LIBSSH2_LIBRARY}) set(CMAKE_REQUIRED_LIBRARIES ${LIBSSH2_LIBRARY}) set(CMAKE_REQUIRED_INCLUDES "${LIBSSH2_INCLUDE_DIR}") set(HAVE_LIBSSH2 ON) set(USE_LIBSSH2 ON) # find_package has already found the headers set(CURL_INCLUDES ${CURL_INCLUDES} "${LIBSSH2_INCLUDE_DIR}/libssh2.h") set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -DHAVE_LIBSSH2_H") # now check for specific libssh2 symbols as they were added in different versions set(CMAKE_EXTRA_INCLUDE_FILES "libssh2.h") check_function_exists(libssh2_version HAVE_LIBSSH2_VERSION) check_function_exists(libssh2_init HAVE_LIBSSH2_INIT) check_function_exists(libssh2_exit HAVE_LIBSSH2_EXIT) check_function_exists(libssh2_scp_send64 HAVE_LIBSSH2_SCP_SEND64) check_function_exists(libssh2_session_handshake HAVE_LIBSSH2_SESSION_HANDSHAKE) set(CMAKE_EXTRA_INCLUDE_FILES "") endif(LIBSSH2_FOUND) endif(CMAKE_USE_LIBSSH2) # If we have features.h, then do the _BSD_SOURCE magic check_include_file("features.h" HAVE_FEATURES_H) # Check for header files if(NOT UNIX) check_include_file_concat("ws2tcpip.h" HAVE_WS2TCPIP_H) Loading Loading @@ -337,7 +366,6 @@ check_include_file_concat("ifaddrs.h" HAVE_IFADDRS_H) check_include_file_concat("io.h" HAVE_IO_H) check_include_file_concat("krb.h" HAVE_KRB_H) check_include_file_concat("libgen.h" HAVE_LIBGEN_H) check_include_file_concat("libssh2.h" HAVE_LIBSSH2_H) check_include_file_concat("limits.h" HAVE_LIMITS_H) check_include_file_concat("locale.h" HAVE_LOCALE_H) check_include_file_concat("net/if.h" HAVE_NET_IF_H) Loading Loading @@ -779,6 +807,10 @@ function(SETUP_CURL_DEPENDENCIES TARGET_NAME) #ADD_DEFINITIONS( -DUSE_SSLEAY ) endif() if(CMAKE_USE_LIBSSH2 AND LIBSSH2_FOUND) include_directories(${LIBSSH2_INCLUDE_DIR}) endif() target_link_libraries(${TARGET_NAME} ${CURL_LIBS}) endfunction() Loading lib/curl_config.h.cmake +15 −0 Original line number Diff line number Diff line Loading @@ -356,6 +356,21 @@ /* Define to 1 if you have the `ssh2' library (-lssh2). */ #cmakedefine HAVE_LIBSSH2 1 /* Define to 1 if libssh2 provides `libssh2_version'. */ #cmakedefine HAVE_LIBSSH2_VERSION 1 /* Define to 1 if libssh2 provides `libssh2_init'. */ #cmakedefine HAVE_LIBSSH2_INIT 1 /* Define to 1 if libssh2 provides `libssh2_exit'. */ #cmakedefine HAVE_LIBSSH2_EXIT 1 /* Define to 1 if libssh2 provides `libssh2_scp_send64'. */ #cmakedefine HAVE_LIBSSH2_SCP_SEND64 1 /* Define to 1 if libssh2 provides `libssh2_session_handshake'. */ #cmakedefine HAVE_LIBSSH2_SESSION_HANDSHAKE 1 /* Define to 1 if you have the <libssh2.h> header file. */ #cmakedefine HAVE_LIBSSH2_H 1 Loading Loading
CMake/FindLibSSH2.cmake 0 → 100644 +35 −0 Original line number Diff line number Diff line # - Try to find the libssh2 library # Once done this will define # # LIBSSH2_FOUND - system has the libssh2 library # LIBSSH2_INCLUDE_DIR - the libssh2 include directory # LIBSSH2_LIBRARY - the libssh2 library name if (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY) set(LibSSH2_FIND_QUIETLY TRUE) endif (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY) FIND_PATH(LIBSSH2_INCLUDE_DIR libssh2.h ) FIND_LIBRARY(LIBSSH2_LIBRARY NAMES ssh2 ) if(LIBSSH2_INCLUDE_DIR) file(STRINGS "${LIBSSH2_INCLUDE_DIR}/libssh2.h" libssh2_version_str REGEX "^#define[\t ]+LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9][0-9][0-9][0-9][0-9].*") string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_MAJOR "${libssh2_version_str}") string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9]([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_MINOR "${libssh2_version_str}") string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9][0-9][0-9]([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_PATCH "${libssh2_version_str}") string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_MAJOR "${LIBSSH2_VERSION_MAJOR}") string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_MINOR "${LIBSSH2_VERSION_MINOR}") string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_PATCH "${LIBSSH2_VERSION_PATCH}") set(LIBSSH2_VERSION "${LIBSSH2_VERSION_MAJOR}.${LIBSSH2_VERSION_MINOR}.${LIBSSH2_VERSION_PATCH}") endif(LIBSSH2_INCLUDE_DIR) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibSSH2 DEFAULT_MSG LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY ) MARK_AS_ADVANCED(LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY LIBSSH2_VERSION_MAJOR LIBSSH2_VERSION_MINOR LIBSSH2_VERSION_PATCH LIBSSH2_VERSION)
CMakeLists.txt +35 −3 Original line number Diff line number Diff line Loading @@ -289,11 +289,40 @@ if(CMAKE_USE_OPENSSL) endif(OPENSSL_FOUND) endif(CMAKE_USE_OPENSSL) #libSSH2 option(CMAKE_USE_LIBSSH2 "Use libSSH2" ON) mark_as_advanced(CMAKE_USE_LIBSSH2) set(USE_LIBSSH2 OFF) set(HAVE_LIBSSH2 OFF) if(CMAKE_USE_LIBSSH2) find_package(LibSSH2) if(LIBSSH2_FOUND) list(APPEND CURL_LIBS ${LIBSSH2_LIBRARY}) set(CMAKE_REQUIRED_LIBRARIES ${LIBSSH2_LIBRARY}) set(CMAKE_REQUIRED_INCLUDES "${LIBSSH2_INCLUDE_DIR}") set(HAVE_LIBSSH2 ON) set(USE_LIBSSH2 ON) # find_package has already found the headers set(CURL_INCLUDES ${CURL_INCLUDES} "${LIBSSH2_INCLUDE_DIR}/libssh2.h") set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -DHAVE_LIBSSH2_H") # now check for specific libssh2 symbols as they were added in different versions set(CMAKE_EXTRA_INCLUDE_FILES "libssh2.h") check_function_exists(libssh2_version HAVE_LIBSSH2_VERSION) check_function_exists(libssh2_init HAVE_LIBSSH2_INIT) check_function_exists(libssh2_exit HAVE_LIBSSH2_EXIT) check_function_exists(libssh2_scp_send64 HAVE_LIBSSH2_SCP_SEND64) check_function_exists(libssh2_session_handshake HAVE_LIBSSH2_SESSION_HANDSHAKE) set(CMAKE_EXTRA_INCLUDE_FILES "") endif(LIBSSH2_FOUND) endif(CMAKE_USE_LIBSSH2) # If we have features.h, then do the _BSD_SOURCE magic check_include_file("features.h" HAVE_FEATURES_H) # Check for header files if(NOT UNIX) check_include_file_concat("ws2tcpip.h" HAVE_WS2TCPIP_H) Loading Loading @@ -337,7 +366,6 @@ check_include_file_concat("ifaddrs.h" HAVE_IFADDRS_H) check_include_file_concat("io.h" HAVE_IO_H) check_include_file_concat("krb.h" HAVE_KRB_H) check_include_file_concat("libgen.h" HAVE_LIBGEN_H) check_include_file_concat("libssh2.h" HAVE_LIBSSH2_H) check_include_file_concat("limits.h" HAVE_LIMITS_H) check_include_file_concat("locale.h" HAVE_LOCALE_H) check_include_file_concat("net/if.h" HAVE_NET_IF_H) Loading Loading @@ -779,6 +807,10 @@ function(SETUP_CURL_DEPENDENCIES TARGET_NAME) #ADD_DEFINITIONS( -DUSE_SSLEAY ) endif() if(CMAKE_USE_LIBSSH2 AND LIBSSH2_FOUND) include_directories(${LIBSSH2_INCLUDE_DIR}) endif() target_link_libraries(${TARGET_NAME} ${CURL_LIBS}) endfunction() Loading
lib/curl_config.h.cmake +15 −0 Original line number Diff line number Diff line Loading @@ -356,6 +356,21 @@ /* Define to 1 if you have the `ssh2' library (-lssh2). */ #cmakedefine HAVE_LIBSSH2 1 /* Define to 1 if libssh2 provides `libssh2_version'. */ #cmakedefine HAVE_LIBSSH2_VERSION 1 /* Define to 1 if libssh2 provides `libssh2_init'. */ #cmakedefine HAVE_LIBSSH2_INIT 1 /* Define to 1 if libssh2 provides `libssh2_exit'. */ #cmakedefine HAVE_LIBSSH2_EXIT 1 /* Define to 1 if libssh2 provides `libssh2_scp_send64'. */ #cmakedefine HAVE_LIBSSH2_SCP_SEND64 1 /* Define to 1 if libssh2 provides `libssh2_session_handshake'. */ #cmakedefine HAVE_LIBSSH2_SESSION_HANDSHAKE 1 /* Define to 1 if you have the <libssh2.h> header file. */ #cmakedefine HAVE_LIBSSH2_H 1 Loading