[question] Mimicking CMake Find Modules
See original GitHub issueWhen 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:
- Created 4 years ago
- Reactions:8
- Comments:11 (11 by maintainers)
Top GitHub Comments
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.
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 upstreamXxxConfig.cmake
files is effectively locking developers into the Conan ecosystem or forcing them to jump through hoops to break out of it.