1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-10-30 12:05:34 +03:00
Commit Graph

5 Commits

Author SHA1 Message Date
Viktor Szakats
932d6a3277 cmake: fix multiple include of libssh2 package
Also extend our integration test double inclusion. It will still not
catch this case, because that requires
`cmake_minimum_required(VERSION 3.18)` or higher.

Fixes:
```
CMake Error at .../lib/cmake/libssh2/libssh2-config.cmake:8 (add_library):
  add_library cannot create ALIAS target "libssh2::libssh2" because another
  target with the same name already exists.
Call Stack (most recent call first):
  CMakeLists.txt:24 (find_package)

CMake Error at .../lib/cmake/libssh2/libssh2-config.cmake:13 (add_library):
  add_library cannot create ALIAS target "Libssh2::libssh2" because another
  target with the same name already exists.
Call Stack (most recent call first):
  CMakeLists.txt:24 (find_package)
```

Test to reproduce:
```cmake
cmake_minimum_required(VERSION 3.18)  # must be 3.18 or higher

project(test)

find_package(libssh2 CONFIG)
find_package(libssh2 CONFIG)  # fails

add_executable(test main.c)
target_link_libraries(test libssh2::libssh2)
```

Ref: https://cmake.org/cmake/help/latest/release/3.18.html#other-changes
Ref: https://cmake.org/cmake/help/v3.18/policy/CMP0107.html

Assisted-by: Kai Pastor
Assisted-by: Harry Mallon
Ref: https://github.com/curl/curl/pull/11913

Closes #1216
2023-11-09 22:38:07 +00:00
Viktor Szakats
5453fc8035 cmake: add LIB_NAME variable
It holds the name `libssh2`. Mainly to document its uses, and also
syncing up with the same variable in libcurl.

Closes #1159
2023-08-13 10:20:57 +00:00
Viktor Szakats
c705ff3f37 cmake: add one missed PROJECT_NAME variable
Follow-up to 72fd25958a

Closes #1158
2023-08-11 23:09:52 +00:00
Viktor Szakats
72fd25958a cmake: replace libssh2 literals with PROJECT_NAME variable
Where applicable.

This also makes it more obvious which `libssh2` uses were referring
to the project itself.

Closes #1152
2023-08-09 15:47:49 +00:00
Viktor Szakats
2da13c13e1 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
2023-06-25 19:14:18 +00:00