mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-31 00:03:08 +03:00
cmake: re-add Libssh2:libssh2
for compatibiliy + lowercase namespace
- add `libssh2:libssh2` target that selects the shared lib if built, otherwise the static one. - re-add `Libssh2:libssh2` target for compatibility with v1.10.0 and earlier. This is an alias for `libssh2:libssh2`. - keep `libssh2:libssh2_shared` and `libssh2_libssh2_static` targets. - allow using `find_package(libssh2)` in dependents as an alternative to `find_package(Libssh2)`. Co-authored-by: Radek Brich Suggested-by: Haowei Hsu Fixes #1103 Fixes #731 Closes #1104
This commit is contained in:
@ -134,8 +134,8 @@ setting it up with libssh2's location. Add the following lines and
|
||||
CMake will find libssh2 on your system, set up the necessary paths and
|
||||
link the library with your binary.
|
||||
|
||||
find_package(Libssh2 REQUIRED CONFIG)
|
||||
target_link_libraries(my_project_target Libssh2::libssh2)
|
||||
find_package(libssh2 REQUIRED CONFIG)
|
||||
target_link_libraries(my_project_target libssh2::libssh2)
|
||||
|
||||
You still have to make libssh2 available on your system first. You can
|
||||
install it in the traditional way shown above, but you do not have to.
|
||||
@ -149,13 +149,13 @@ builds your project:
|
||||
include(ExternalProject)
|
||||
|
||||
ExternalProject_Add(
|
||||
Libssh2
|
||||
libssh2
|
||||
URL <libssh2 download location>
|
||||
URL_HASH SHA256=<libssh2 archive SHA256>
|
||||
INSTALL_COMMAND "")
|
||||
|
||||
ExternalProject_Add(
|
||||
MyProject DEPENDS Libssh2
|
||||
MyProject DEPENDS libssh2
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
INSTALL_COMMAND "")
|
||||
|
||||
|
Reference in New Issue
Block a user