1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-31 00:03:08 +03:00

cmake: misc improvements, add LIBSSH2_USE_PKGCONFIG option

- show platform flags (via curl).
- add `LIBSSH2_USE_PKGCONFIG` option to control whether to use
  `pkg-config` to find dependencies.
- set `.pc` names withing the Find modules.
- add `mbedcrypto` to `libssh2.pc` only when detected via `pkg-config`.
  Workaround for older mbedtls versions and non-CMake mbedTLS builds
  (as of mbedTLS 3.6.2) that don't emit an `mbedcrypto.pc` file.
- set header paths relative to the project root (tidy-up).
- use `-isystem` for crypto backend and zlib header paths.
  To match autotools.
- sync header path order with autotools.
- rename local variables to underscore-lowercase.
- minor tidy-ups.

Cherry-picked from #1484
Closes #1525
This commit is contained in:
Viktor Szakats
2024-11-02 16:54:53 +01:00
parent 854cfa8292
commit a3aa6b4ca8
7 changed files with 95 additions and 31 deletions

View File

@ -49,8 +49,8 @@ foreach(_example IN LISTS noinst_PROGRAMS)
list(APPEND _example_targets ${_example})
# to find generated header
target_include_directories(${_example} PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/../src"
"../src")
"${PROJECT_BINARY_DIR}/src"
"${PROJECT_SOURCE_DIR}/src")
target_link_libraries(${_example} ${LIB_SELECTED} ${LIBSSH2_LIBS})
set_target_properties(${_example} PROPERTIES UNITY_BUILD OFF)
endforeach()