File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -292,7 +292,18 @@ IF (LIBSSH2_FOUND)
292
292
LIST (APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS} )
293
293
#SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} ${LIBSSH2_LDFLAGS}")
294
294
295
- CHECK_LIBRARY_EXISTS ("${LIBSSH2_LIBRARIES} " libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS} " HAVE_LIBSSH2_MEMORY_CREDENTIALS )
295
+ # We might need to provide additional libraries so libssh2 links
296
+ SET (CMAKE_REQUIRED_LIBRARIES_OLD ${CMAKE_REQUIRED_LIBRARIES} )
297
+ IF (BUILD_SHARED_LIBS )
298
+ SET (CMAKE_REQUIRED_LIBRARIES ${LIBSSH2_LIBRARIES} )
299
+ SET (LIBSSH2_TMP_LIBRARY_DIRS ${LIBSSH2_LIBRARY_DIRS} )
300
+ ELSE ()
301
+ SET (CMAKE_REQUIRED_LIBRARIES ${LIBSSH2_STATIC_LIBRARIES} )
302
+ SET (LIBSSH2_TMP_LIBRARY_DIRS ${LIBSSH2_STATIC_LIBRARY_DIRS} )
303
+ ENDIF ()
304
+ CHECK_LIBRARY_EXISTS (ssh2 libssh2_userauth_publickey_frommemory "${LIBSSH2_TMP_LIBRARY_DIRS} " HAVE_LIBSSH2_MEMORY_CREDENTIALS )
305
+ SET (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_OLD} )
306
+ UNSET (LIBSSH2_TMP_LIBRARY_DIRS )
296
307
IF (HAVE_LIBSSH2_MEMORY_CREDENTIALS )
297
308
SET (GIT_SSH_MEMORY_CREDENTIALS 1 )
298
309
ENDIF ()
You can’t perform that action at this time.
0 commit comments