conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.22k stars 979 forks source link

[question] can CMakeDeps generate multiple xxxConfig.cmake files? #14373

Open forthib opened 1 year ago

forthib commented 1 year ago

What is your question?

Hello,

Is this possible to define a package that will generate multiple Config.cmake files when used with CMakeDeps generator?

My use case is the following:

In order to keep upstream files of the consumer unmodified, I would like CMakeDeps to generate LAPACKConfig.cmake and SCALAPACKConfig.cmake. Is it possible, maybe using some properties of components in package_info()?

Have you read the CONTRIBUTING guide?

memsharded commented 1 year ago

Hi @forthib

CMakeDeps cannot generate those files, only 1 per package.

But maybe for this case you are good using the in-package config.cmake files created by the build? This is possible with CMakeToolchain, because it can add the paths to the packages (adding self.cpp_info.builddirs information)

SpaceIm commented 1 year ago

Already asked long time ago in https://github.com/conan-io/conan/issues/9000. It's still a problem for several conancenter recipes where modularization is impossible but to properly emulate upstream installation, several CMake config files would have to be generated by CMakeDeps. qt is one of them, but it's partially impacted. You can do find_package(Qt5 REQUIRED Core), but with an official installation, find_package(Qt5Core REQUIRED) is also possible (but not recommended AFAIK). There is also another way to find Qt6 or Qt5: find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) which can't be supported by CMakeDeps in qt recipe.