mirror of
https://github.com/curl/curl.git
synced 2026-04-14 18:11:40 +03:00
cmake: add CMake Config-based dependency detection
After limiting `find_package()`/`find_dependency()` calls to curl local Find modules via the `MODULES` keyword, it became possible to detect dependencies via CMake Configs from within those local Find modules, by calling `find_package()` again with the `CONFIG` keyword. This patch implements this. Then maps detection results to the result variables and curl-specific imported targets the rest of the build expects. Also honor recently introduced `*_USE_STATIC_LIBS` (experimental) flags to map to the static target when requested. This adds CMake Configs as an alternative to the existing `pkg-config` and `find_path()`/`find_library()` auto-detection methods. Enabled by default for MSVC, outside vcpkg and when not cross-building. To enable for other cases, or override the default, you can use `-DCURL_USE_CMAKECONFIG=ON` or `OFF`. When enabled, Config detection happens after `pkg-config` and before `find_path()`/`find_library()`. Using CMake's built-in options, you may also manually point to the absolute directory holding Config files: `Libssh2_DIR`, `MbedTLS_DIR`, `NGHTTP2_DIR`, `NGHTTP3_DIR`, `NGTCP2_DIR` v1.19.0+ (with non-fork OpenSSL only), `Zstd_DIR` v1.4.5+ E.g. `-DMbedTLS_DIR=/path/to/mbedtls/lib/cmake/MbedTLS` These dependencies typically need to be built with CMake to support this. Tagged as experimental. Refs: #20013 #19156 #19117 https://github.com/curl/curl/pull/20784#issuecomment-3984318492 Depends-on:fad1ebaecc#20840 Follow-up to91e06fde1b#20784 Follow-up to26c39d8df1#20015 Closes #20814
This commit is contained in:
parent
aef8fd00c8
commit
8fce3e17e6
11 changed files with 142 additions and 29 deletions
|
|
@ -347,6 +347,7 @@ Details via CMake
|
|||
## Dependencies
|
||||
|
||||
- `CURL_BROTLI`: Use brotli (`ON`, `OFF` or `AUTO`). Default: `AUTO`
|
||||
- `CURL_USE_CMAKECONFIG`: Enable detecting dependencies via CMake Config. Default: `ON` for MSVC (except under vcpkg), if not cross-compiling. (experimental)
|
||||
- `CURL_USE_GNUTLS`: Enable GnuTLS for SSL/TLS. Default: `OFF`
|
||||
- `CURL_USE_GSASL`: Use libgsasl. Default: `OFF`
|
||||
- `CURL_USE_GSSAPI`: Use GSSAPI implementation. Default: `OFF`
|
||||
|
|
@ -383,6 +384,11 @@ Details via CMake
|
|||
- `ZLIB_INCLUDE_DIR`: Absolute path to zlib include directory.
|
||||
- `ZLIB_LIBRARY`: Absolute path to `zlib` library.
|
||||
- `ZLIB_USE_STATIC_LIBS`: Look for static `zlib` library (requires CMake v3.24).
|
||||
- `<PackageName>_DIR`: Absolute path to `<PackageName>` CMake Config directory where `*.cmake` files reside. Used when `CURL_USE_CMAKECONFIG` is enabled.
|
||||
`<PackageName>` may be:
|
||||
`Libssh2`, `MbedTLS`, `NGHTTP2`, `NGHTTP3`,
|
||||
`NGTCP2` 1.19.0+ (with non-fork OpenSSL only),
|
||||
`Zstd` 1.4.5+.
|
||||
|
||||
## Dependency options (tools)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue