diff options
| author | Yoichi Nakayama <yoichi.nakayama@gmail.com> | 2021-11-23 10:12:29 +0900 |
|---|---|---|
| committer | Yoichi Nakayama <yoichi.nakayama@gmail.com> | 2021-11-23 10:20:04 +0900 |
| commit | 7bb206a76dca70b7db236315d348c6c9fc325cab (patch) | |
| tree | e38bb2d225746de8343db08837840e84aad3ece0 /cmake/SelectSSH.cmake | |
| parent | 540b02f3b97baf2bc1d62210a23d522b5d73e5eb (diff) | |
| parent | f9c4dc10d90732cfbe2271dd58b01dd8f4003d15 (diff) | |
| download | libgit2-7bb206a76dca70b7db236315d348c6c9fc325cab.tar.gz | |
Merge branch 'main' into better-compatiblity-for-at-time-notation
Conflicts:
src/revparse.c
Diffstat (limited to 'cmake/SelectSSH.cmake')
| -rw-r--r-- | cmake/SelectSSH.cmake | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/cmake/SelectSSH.cmake b/cmake/SelectSSH.cmake new file mode 100644 index 000000000..23dfc9785 --- /dev/null +++ b/cmake/SelectSSH.cmake @@ -0,0 +1,41 @@ +# Optional external dependency: libssh2 +if(USE_SSH) + find_pkglibraries(LIBSSH2 libssh2) + if(NOT LIBSSH2_FOUND) + find_package(LibSSH2) + set(LIBSSH2_INCLUDE_DIRS ${LIBSSH2_INCLUDE_DIR}) + get_filename_component(LIBSSH2_LIBRARY_DIRS "${LIBSSH2_LIBRARY}" DIRECTORY) + set(LIBSSH2_LIBRARIES ${LIBSSH2_LIBRARY}) + set(LIBSSH2_LDFLAGS "-lssh2") + endif() + + if(NOT LIBSSH2_FOUND) + message(FATAL_ERROR "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") + endif() +endif() + +if(LIBSSH2_FOUND) + set(GIT_SSH 1) + list(APPEND LIBGIT2_SYSTEM_INCLUDES ${LIBSSH2_INCLUDE_DIRS}) + list(APPEND LIBGIT2_SYSTEM_LIBS ${LIBSSH2_LIBRARIES}) + list(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS}) + + check_library_exists("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS) + if(HAVE_LIBSSH2_MEMORY_CREDENTIALS) + set(GIT_SSH_MEMORY_CREDENTIALS 1) + endif() +else() + message(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") +endif() + +if(WIN32 AND EMBED_SSH_PATH) + file(GLOB SSH_SRC "${EMBED_SSH_PATH}/src/*.c") + list(SORT SSH_SRC) + list(APPEND LIBGIT2_DEPENDENCY_OBJECTS ${SSH_SRC}) + + list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${EMBED_SSH_PATH}/include") + file(WRITE "${EMBED_SSH_PATH}/src/libssh2_config.h" "#define HAVE_WINCNG\n#define LIBSSH2_WINCNG\n#include \"../win32/libssh2_config.h\"") + set(GIT_SSH 1) +endif() + +add_feature_info(SSH GIT_SSH "SSH transport support") |
