Dear cmake team and user community,
I'd kindly like to ask for advice on how to handle transitive
dependencies cleanly with "modern" cmake. I'm often plagued by this
problem: I have a library X that optionally depends on library A.
When I build library Y that depends on X, how do I (cleanly) handle
the optional dependency A?
Assume "A" would be "Qt5Core". I can link X publicly against Qt5::Core.
But when I import X into Y, then Y will complain about unknown target
Qt5::Core, unless I do find_package(Qt5 COMPONENTS Core) in Y. But since
Qt is optional in X, I would need to track somehow if Qt was enabled
before.
But what good is the public transitive dependency when I manually need
to track it, to find the libraries again? Am I missing something?
Can the dependency be automatically resolved, or can I query some
variable if X was linking A?
How to do this cleanly?
Thanks a lot and all the best,
Mario Emmenlauer
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake