| 1 |
if(USE_SSH STREQUAL "exec") |
| 2 |
set(GIT_SSH 1) |
| 3 |
set(GIT_SSH_EXEC 1) |
| 4 |
|
| 5 |
add_feature_info(SSH ON "using OpenSSH exec support") |
| 6 |
elseif(USE_SSH STREQUAL ON OR USE_SSH STREQUAL "libssh2") |
| 7 |
find_pkglibraries(LIBSSH2 libssh2) |
| 8 |
|
| 9 |
if(LIBSSH2_FOUND) |
| 10 |
set(LIBSSH2_FOUND_PKGCONFIG 1) |
| 11 |
else() |
| 12 |
find_package(LibSSH2) |
| 13 |
set(LIBSSH2_INCLUDE_DIRS ${LIBSSH2_INCLUDE_DIR}) |
| 14 |
get_filename_component(LIBSSH2_LIBRARY_DIRS "${LIBSSH2_LIBRARY}" DIRECTORY) |
| 15 |
set(LIBSSH2_LIBRARIES ${LIBSSH2_LIBRARY}) |
| 16 |
set(LIBSSH2_LDFLAGS "-lssh2") |
| 17 |
endif() |
| 18 |
|
| 19 |
if(NOT LIBSSH2_FOUND) |
| 20 |
message(FATAL_ERROR "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") |
| 21 |
endif() |
| 22 |
|
| 23 |
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${LIBSSH2_INCLUDE_DIRS}) |
| 24 |
list(APPEND LIBGIT2_SYSTEM_LIBS ${LIBSSH2_LIBRARIES}) |
| 25 |
if(LIBSSH2_FOUND_PKGCONFIG) |
| 26 |
list(APPEND LIBGIT2_PC_REQUIRES "libssh2") |
| 27 |
else() |
| 28 |
list(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS}) |
| 29 |
endif() |
| 30 |
|
| 31 |
check_library_exists("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS) |
| 32 |
if(HAVE_LIBSSH2_MEMORY_CREDENTIALS) |
| 33 |
set(GIT_SSH_LIBSSH2_MEMORY_CREDENTIALS 1) |
| 34 |
endif() |
| 35 |
|
| 36 |
if(WIN32 AND EMBED_SSH_PATH) |
| 37 |
file(GLOB SSH_SRC "${EMBED_SSH_PATH}/src/*.c") |
| 38 |
list(SORT SSH_SRC) |
| 39 |
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS ${SSH_SRC}) |
| 40 |
|
| 41 |
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${EMBED_SSH_PATH}/include") |
| 42 |
file(WRITE "${EMBED_SSH_PATH}/src/libssh2_config.h" "#define HAVE_WINCNG\n#define LIBSSH2_WINCNG\n#include \"../win32/libssh2_config.h\"") |
| 43 |
endif() |
| 44 |
|
| 45 |
set(GIT_SSH 1) |
| 46 |
set(GIT_SSH_LIBSSH2 1) |
| 47 |
add_feature_info(SSH ON "using libssh2") |
| 48 |
elseif(USE_SSH STREQUAL OFF OR USE_SSH STREQUAL "") |
| 49 |
add_feature_info(SSH OFF "SSH transport support") |
| 50 |
else() |
| 51 |
message(FATAL_ERROR "unknown SSH option: ${USE_SSH}") |
| 52 |
endif() |