Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
118977f1
Commit
118977f1
authored
10 years ago
by
Jakub Zakrzewski
Committed by
Daniel Stenberg
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Cmake: LibSSH2 detection and use.
parent
88c17d55
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMake/FindLibSSH2.cmake
+35
-0
35 additions, 0 deletions
CMake/FindLibSSH2.cmake
CMakeLists.txt
+35
-3
35 additions, 3 deletions
CMakeLists.txt
lib/curl_config.h.cmake
+15
-0
15 additions, 0 deletions
lib/curl_config.h.cmake
with
85 additions
and
3 deletions
CMake/FindLibSSH2.cmake
0 → 100644
+
35
−
0
View file @
118977f1
# - Try to find the libssh2 library
# Once done this will define
#
# LIBSSH2_FOUND - system has the libssh2 library
# LIBSSH2_INCLUDE_DIR - the libssh2 include directory
# LIBSSH2_LIBRARY - the libssh2 library name
if
(
LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY
)
set
(
LibSSH2_FIND_QUIETLY TRUE
)
endif
(
LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY
)
FIND_PATH
(
LIBSSH2_INCLUDE_DIR libssh2.h
)
FIND_LIBRARY
(
LIBSSH2_LIBRARY NAMES ssh2
)
if
(
LIBSSH2_INCLUDE_DIR
)
file
(
STRINGS
"
${
LIBSSH2_INCLUDE_DIR
}
/libssh2.h"
libssh2_version_str REGEX
"^#define[
\t
]+LIBSSH2_VERSION_NUM[
\t
]+0x[0-9][0-9][0-9][0-9][0-9][0-9].*"
)
string
(
REGEX REPLACE
"^.*LIBSSH2_VERSION_NUM[
\t
]+0x([0-9][0-9]).*$"
"
\\
1"
LIBSSH2_VERSION_MAJOR
"
${
libssh2_version_str
}
"
)
string
(
REGEX REPLACE
"^.*LIBSSH2_VERSION_NUM[
\t
]+0x[0-9][0-9]([0-9][0-9]).*$"
"
\\
1"
LIBSSH2_VERSION_MINOR
"
${
libssh2_version_str
}
"
)
string
(
REGEX REPLACE
"^.*LIBSSH2_VERSION_NUM[
\t
]+0x[0-9][0-9][0-9][0-9]([0-9][0-9]).*$"
"
\\
1"
LIBSSH2_VERSION_PATCH
"
${
libssh2_version_str
}
"
)
string
(
REGEX REPLACE
"^0(.+)"
"
\\
1"
LIBSSH2_VERSION_MAJOR
"
${
LIBSSH2_VERSION_MAJOR
}
"
)
string
(
REGEX REPLACE
"^0(.+)"
"
\\
1"
LIBSSH2_VERSION_MINOR
"
${
LIBSSH2_VERSION_MINOR
}
"
)
string
(
REGEX REPLACE
"^0(.+)"
"
\\
1"
LIBSSH2_VERSION_PATCH
"
${
LIBSSH2_VERSION_PATCH
}
"
)
set
(
LIBSSH2_VERSION
"
${
LIBSSH2_VERSION_MAJOR
}
.
${
LIBSSH2_VERSION_MINOR
}
.
${
LIBSSH2_VERSION_PATCH
}
"
)
endif
(
LIBSSH2_INCLUDE_DIR
)
include
(
FindPackageHandleStandardArgs
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS
(
LibSSH2 DEFAULT_MSG LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY
)
MARK_AS_ADVANCED
(
LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY LIBSSH2_VERSION_MAJOR LIBSSH2_VERSION_MINOR LIBSSH2_VERSION_PATCH LIBSSH2_VERSION
)
This diff is collapsed.
Click to expand it.
CMakeLists.txt
+
35
−
3
View file @
118977f1
...
...
@@ -289,11 +289,40 @@ if(CMAKE_USE_OPENSSL)
endif
(
OPENSSL_FOUND
)
endif
(
CMAKE_USE_OPENSSL
)
#libSSH2
option
(
CMAKE_USE_LIBSSH2
"Use libSSH2"
ON
)
mark_as_advanced
(
CMAKE_USE_LIBSSH2
)
set
(
USE_LIBSSH2 OFF
)
set
(
HAVE_LIBSSH2 OFF
)
if
(
CMAKE_USE_LIBSSH2
)
find_package
(
LibSSH2
)
if
(
LIBSSH2_FOUND
)
list
(
APPEND CURL_LIBS
${
LIBSSH2_LIBRARY
}
)
set
(
CMAKE_REQUIRED_LIBRARIES
${
LIBSSH2_LIBRARY
}
)
set
(
CMAKE_REQUIRED_INCLUDES
"
${
LIBSSH2_INCLUDE_DIR
}
"
)
set
(
HAVE_LIBSSH2 ON
)
set
(
USE_LIBSSH2 ON
)
# find_package has already found the headers
set
(
CURL_INCLUDES
${
CURL_INCLUDES
}
"
${
LIBSSH2_INCLUDE_DIR
}
/libssh2.h"
)
set
(
CURL_TEST_DEFINES
"
${
CURL_TEST_DEFINES
}
-DHAVE_LIBSSH2_H"
)
# now check for specific libssh2 symbols as they were added in different versions
set
(
CMAKE_EXTRA_INCLUDE_FILES
"libssh2.h"
)
check_function_exists
(
libssh2_version HAVE_LIBSSH2_VERSION
)
check_function_exists
(
libssh2_init HAVE_LIBSSH2_INIT
)
check_function_exists
(
libssh2_exit HAVE_LIBSSH2_EXIT
)
check_function_exists
(
libssh2_scp_send64 HAVE_LIBSSH2_SCP_SEND64
)
check_function_exists
(
libssh2_session_handshake HAVE_LIBSSH2_SESSION_HANDSHAKE
)
set
(
CMAKE_EXTRA_INCLUDE_FILES
""
)
endif
(
LIBSSH2_FOUND
)
endif
(
CMAKE_USE_LIBSSH2
)
# If we have features.h, then do the _BSD_SOURCE magic
check_include_file
(
"features.h"
HAVE_FEATURES_H
)
# Check for header files
if
(
NOT UNIX
)
check_include_file_concat
(
"ws2tcpip.h"
HAVE_WS2TCPIP_H
)
...
...
@@ -337,7 +366,6 @@ check_include_file_concat("ifaddrs.h" HAVE_IFADDRS_H)
check_include_file_concat
(
"io.h"
HAVE_IO_H
)
check_include_file_concat
(
"krb.h"
HAVE_KRB_H
)
check_include_file_concat
(
"libgen.h"
HAVE_LIBGEN_H
)
check_include_file_concat
(
"libssh2.h"
HAVE_LIBSSH2_H
)
check_include_file_concat
(
"limits.h"
HAVE_LIMITS_H
)
check_include_file_concat
(
"locale.h"
HAVE_LOCALE_H
)
check_include_file_concat
(
"net/if.h"
HAVE_NET_IF_H
)
...
...
@@ -779,6 +807,10 @@ function(SETUP_CURL_DEPENDENCIES TARGET_NAME)
#ADD_DEFINITIONS( -DUSE_SSLEAY )
endif
()
if
(
CMAKE_USE_LIBSSH2 AND LIBSSH2_FOUND
)
include_directories
(
${
LIBSSH2_INCLUDE_DIR
}
)
endif
()
target_link_libraries
(
${
TARGET_NAME
}
${
CURL_LIBS
}
)
endfunction
()
...
...
This diff is collapsed.
Click to expand it.
lib/curl_config.h.cmake
+
15
−
0
View file @
118977f1
...
...
@@ -356,6 +356,21 @@
/* Define to 1 if you have the `ssh2'
library
(
-lssh2
)
. */
#cmakedefine HAVE_LIBSSH2 1
/* Define to 1 if libssh2 provides `libssh2_version'. */
#cmakedefine HAVE_LIBSSH2_VERSION 1
/* Define to 1 if libssh2 provides `libssh2_init'. */
#cmakedefine HAVE_LIBSSH2_INIT 1
/* Define to 1 if libssh2 provides `libssh2_exit'. */
#cmakedefine HAVE_LIBSSH2_EXIT 1
/* Define to 1 if libssh2 provides `libssh2_scp_send64'. */
#cmakedefine HAVE_LIBSSH2_SCP_SEND64 1
/* Define to 1 if libssh2 provides `libssh2_session_handshake'. */
#cmakedefine HAVE_LIBSSH2_SESSION_HANDSHAKE 1
/* Define to 1 if you have the <libssh2.h> header file. */
#cmakedefine HAVE_LIBSSH2_H 1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment