1
- # Optional external dependency: libssh2
2
- if (USE_SSH)
1
+ # find libssh2
2
+ if (USE_SSH STREQUAL ON OR USE_SSH STREQUAL "libssh2" )
3
3
find_pkglibraries(LIBSSH2 libssh2)
4
+
4
5
if (NOT LIBSSH2_FOUND)
5
6
find_package (LibSSH2)
6
7
set (LIBSSH2_INCLUDE_DIRS ${LIBSSH2_INCLUDE_DIR} )
@@ -12,30 +13,28 @@ if(USE_SSH)
12
13
if (NOT LIBSSH2_FOUND)
13
14
message (FATAL_ERROR "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path." )
14
15
endif ()
15
- endif ()
16
16
17
- if (LIBSSH2_FOUND)
18
- set (GIT_SSH 1)
19
17
list (APPEND LIBGIT2_SYSTEM_INCLUDES ${LIBSSH2_INCLUDE_DIRS} )
20
18
list (APPEND LIBGIT2_SYSTEM_LIBS ${LIBSSH2_LIBRARIES} )
21
19
list (APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS} )
22
20
23
21
check_library_exists("${LIBSSH2_LIBRARIES} " libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS} " HAVE_LIBSSH2_MEMORY_CREDENTIALS)
24
22
if (HAVE_LIBSSH2_MEMORY_CREDENTIALS)
25
- set (GIT_SSH_MEMORY_CREDENTIALS 1)
23
+ set (GIT_SSH_LIBSSH2_MEMORY_CREDENTIALS 1)
26
24
endif ()
27
- else ()
28
- message (STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path." )
29
- endif ()
30
25
31
- if (WIN32 AND EMBED_SSH_PATH)
32
- file (GLOB SSH_SRC "${EMBED_SSH_PATH} /src/*.c" )
33
- list (SORT SSH_SRC)
34
- list (APPEND LIBGIT2_DEPENDENCY_OBJECTS ${SSH_SRC} )
26
+ if (WIN32 AND EMBED_SSH_PATH)
27
+ file (GLOB SSH_SRC "${EMBED_SSH_PATH} /src/*.c" )
28
+ list (SORT SSH_SRC)
29
+ list (APPEND LIBGIT2_DEPENDENCY_OBJECTS ${SSH_SRC} )
30
+
31
+ list (APPEND LIBGIT2_DEPENDENCY_INCLUDES "${EMBED_SSH_PATH} /include" )
32
+ file (WRITE "${EMBED_SSH_PATH} /src/libssh2_config.h" "#define HAVE_WINCNG\n #define LIBSSH2_WINCNG\n #include \" ../win32/libssh2_config.h\" " )
33
+ endif ()
35
34
36
- list (APPEND LIBGIT2_DEPENDENCY_INCLUDES "${EMBED_SSH_PATH} /include" )
37
- file (WRITE "${EMBED_SSH_PATH} /src/libssh2_config.h" "#define HAVE_WINCNG\n #define LIBSSH2_WINCNG\n #include \" ../win32/libssh2_config.h\" " )
38
35
set (GIT_SSH 1)
36
+ set (GIT_SSH_LIBSSH2 1)
37
+ add_feature_info(SSH ON "using libssh2" )
38
+ else ()
39
+ add_feature_info(SSH OFF "SSH transport support" )
39
40
endif ()
40
-
41
- add_feature_info(SSH GIT_SSH "SSH transport support" )
0 commit comments