question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question] Mimicking CMake Find Modules

See original GitHub issue

When creating a package that already exists in standard CMake Find Modules it is advised to have a cpp_info.name corresponding to the name expected by the equivalent call to find_package to make sure that the cmake_find_package* generators work smoothly.

However some of these standard CMake recipes provide more CMake variables than those provided by the Conan generators, and libraries using them through find_package tend to make use of these additional variables. The example I had in mind was HDF5 for which I added a recipe to conan-center-index a few weeks ago: it provides more CMake variables that the bare minimum such as HDF5_HL_LIBRARIES or HDF5_IS_PARALLEL.

When adding recipes to conan-center-index for such packages that already standard in CMake, should we also provide those additional variables through cpp_info.build_modules to make sure that the cmake_* generators work with already existing projects in the wild to the best of our ability?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

13reactions
madebrcommented, Dec 12, 2019

Imho, the FindXXX.cmake documentation at cmake.org should be considered as an API. Any deviation of it must be considered a bug.

The recipes created by this repo are targeted to the complete conan community, not only us (=packagers). If some conan find_package script behaves different then the cmake one, users would consider conan as non-functional or broken. The conan find_package script should just work interchangeably with the cmake one.

9reactions
kyllingstadcommented, Apr 24, 2020

Any deviation of it must be considered a bug.

agree, currently we build with conan for development and with yocto for production (regulated industries…) that we cannot interchangeable use the standard find_package() functions makes a lot of issues…

I agree, and would like to add that using Conan for development but not for production is going to be a very common use case. For example, I don’t foresee that any of the big Linux distros are going to adopt Conan for dependency management in the near future, so anyone who wants their software to be distributed with Debian, Red Hat, etc. are going to be in this situation.

Any deviation from the CMake-bundled FindXxx.cmake modules or upstream XxxConfig.cmake files is effectively locking developers into the Conan ecosystem or forcing them to jump through hoops to break out of it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CMake: Overriding a find module - Stack Overflow
In my case, I need to override FindProtobuf.cmake . The problem is, it includes SelectLibraryConfigurations.cmake (which includes more files) ...
Read more >
[CMake] Contribute two new find package implementation.
However, there might be a problem with the RTI_FOUND variable regarding ... Calling FIND_PACKAGE(RTI) without components mimics the current ...
Read more >
cmake-modules(7) — CMake 3.25.1 Documentation
These modules search for third-party software. They are normally called through the find_package() command. FindALSA · FindArmadillo · FindASPELL · FindAVIFile ...
Read more >
Cross Platform Make - CMake
Full documentation specific to the given module is displayed. ... Note that ctest expects to find a test file in the build directory...
Read more >
A very simple question - Usage - CMake Discourse
can I find a ... This is all the cmake code you need to get going. ... at D:/CMake/share/cmake-3.20/Modules/CMakeTestCXXCompiler.cmake:59 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found