Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
e35a22a0
Commit
e35a22a0
authored
Nov 10, 2021
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: refactor libssh2 selection
Move SSH selection into its own cmake module.
parent
f0cb3788
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
26 deletions
+42
-26
cmake/SelectSSH.cmake
+41
-0
src/CMakeLists.txt
+1
-26
No files found.
cmake/SelectSSH.cmake
0 → 100644
View file @
e35a22a0
# 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_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_OBJECTS
${
SSH_SRC
}
)
list
(
APPEND LIBGIT2_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"
)
src/CMakeLists.txt
View file @
e35a22a0
...
...
@@ -115,6 +115,7 @@ include(SelectHTTPSBackend)
include
(
SelectHashes
)
include
(
SelectHTTPParser
)
include
(
SelectRegex
)
include
(
SelectSSH
)
target_sources
(
git2internal PRIVATE
${
SRC_SHA1
}
)
...
...
@@ -151,32 +152,6 @@ elseif(USE_BUNDLED_ZLIB OR NOT ZLIB_FOUND)
add_feature_info
(
zlib ON
"using bundled zlib"
)
endif
()
# 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
()
endif
()
if
(
LIBSSH2_FOUND
)
set
(
GIT_SSH 1
)
list
(
APPEND LIBGIT2_SYSTEM_INCLUDES
${
LIBSSH2_INCLUDE_DIRS
}
)
list
(
APPEND LIBGIT2_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
()
add_feature_info
(
SSH GIT_SSH
"SSH transport support"
)
# Optional external dependency: ntlmclient
if
(
USE_NTLMCLIENT
)
set
(
GIT_NTLM 1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment