Repository navigation
Conversation
E.g. `MbedTLS_FOUND`. It's necessary because `find_dependency()` (as of CMake 3.31.5) does check for this variable when deciding if a Find module had found the dependency successfully. It does not check for the `<uppercase-module-name>_FOUND` name. https://github.com/Kitware/CMake/blob/eacc7287297267203fd65be1ca1daaaf62ebca37/Modules/CMakeFindDependencyMacro.cmake#L93-L97 Since find_package_handle_standard_args() is setting both of these `_FOUND` variables, make sure we set it on the pkg-config codepath which doesn't call find_package_handle_standard_args().
Also document variables consumed by `libssh2-config.cmake.in`.
This is most likely not how this is supposed to be done, but better than just failing in this cases. What's the canonical way to do this, and how OpenSSL and zlib does it (or they just work by accident) is yet to be figured out.
This reverts commit aeee1ae. Several CI Jobs fail: AppVeyor / VS2022, OpenSSL 3, x64, Server 2019, clang-cl — failed https://ci.appveyor.com/project/libssh2org/libssh2/builds/51438007/job/y278mlo1w05dnjyp CI / linux (gcc, amd64, OpenSSL-102-from-source, cmake, ON) (pull_request) Failing after 1m CI / linux (gcc, amd64, OpenSSL-110-from-source, cmake, ON) (pull_request) Failing after 1m CI / macOS (cmake, LibreSSL) (pull_request) Failing after 15s CI / macOS (cmake, OpenSSL 1.1) (pull_request) Failing after 16s CI / macOS (cmake, OpenSSL 3) (pull_request) Failing after 15s CI / msvc (x64, windows, OpenSSL, OFF, OFF, ON, OFF, ON) (pull_request) Failing after 1m https://github.com/libssh2/libssh2/actions/runs/13101423309/job/36550138366?pr=1534 ``` C:\projects\libssh2\src\openssl.h(97,10): fatal error : 'openssl/opensslconf.h' file not found ```
|
/cc @talregev in case you're interested. I used your idea to inherit the pkg-config flag default from the build. It seems cleaner this way. I kept the option to override it at consumption-time. The namespace pollution remains unchanged with this PR, but the integration tests now do work. CMake's built-in OpenSSL Find module implements this by keeping track of dependency details within For those, CMake has a mandatory If targets supported link paths and lib name properties as first class citizens, it'd be a nice and clean way to store all detection results as properties, instead of rolling them in custom variables (that pollute the namespace). Though even with Maybe this mandatory property can be reconstructed with a fair chance of working most of the time, but it seems shaky. Warning about the mandatory property: |
|
@dg0yt |
Mitigated by prefixing with the package name, the only prefix the package may take ownership of. |
|
I tried Do you have a hint where to look? ( edit: libdir (and linker options) are picked up as expected when building libssh2 |
|
Continuing the |
- move dependency properties (libs, libdirs, C flags, header dirs, pkg-config module names) from global lists to imported target `INTERFACE` properties. Rework FInd modules to return their results like this and update the libssh2 build process to use it. It makes Find modules re-usable from the cmake-config script by libssh2 consumers, to integrate with libssh2 dependencies. - define libssh2 dependencies as "imported targets" by the name: `libssh2::<depname>`, e.g. `libssh2::libgcrypt`. - cmake-config: add fall-back logic for CMake without CMP0099 (v3.17 2020-03-20) to set lib directories. - generate `libssh2.pc` based on imported target properties (instead of global lists). - add target property dump debug function. - ci/GHA: also test cmake integration on macOS. Follow-up to 96d7f40 #1534 Closes #1535
CMake:
Find*: set
<modulename>_FOUNDfor compatibility when found viapkg-config. E.g.MbedTLS_FOUND.find_package_handle_standard_args()sets both<MODULENAME>_FOUNDand
<Modulename>_FOUNDwhen detecting the dependency. Some CMakecode relies on this and 3rd-party code may rely on it too. Make sure
to set the latter variant when detecting the dependency via
pkg-config, where we don't callfind_package_handle_standard_args().CMake sets these variable to
TRUE(notONor1). Replicate thisfor compatibility.
libssh2-config.cmake: inherit default
LIBSSH2_USE_PKGCONFIG.Follow-up to a3aa6b4 cmake: misc improvements, add
LIBSSH2_USE_PKGCONFIGoption #1525document variables consumed by
libssh2-config.cmake.in.libssh2-config.cmake: fix to link to non-OpenSSL crypto backends.This is most likely not how this is supposed to be done, but better
than failing.
What's the canonical way to do this, and how OpenSSL and zlib does it
is yet to be figured out.
use
ZLIB::ZLIBto reference zlib.use
IN ITEMSwhere missed.harmonize variable dump output formats.
CMake
find_packageintegration tests:find_package().For performance.
ci/GHA:
Follow-up to d9c2e55 #1460
Follow-up to 82b09f9 #1322