This has come up in the context of Tomviz as a consumer of ParaView/VTK, and as a producer in the context of Avogadro in the past. When we export libraries they often depend on/build upon other libraries. In the case of both projects two of the major libraries are Python and Qt. Not thinking so much of project specific solutions, but more towards what we recommend CMake projects do.
What is the best “modern” approach to exporting/importing dependent libraries? I used to think export Qt5_DIR, Python3_EXECUTABLE etc. I have spent more time that I remember diagnosing issues where developers of a dependent project linked to a different library, in a different path. Ideally it fails to link/run, when we have been less lucky it is more subtle.
I am really thinking of the case where my C++ project exports a number of Qt-derived classes for example, or I wrap C++ code using PyBind11 and a Python version. I want to offer a path for dependent projects to then make use of my project, so they do a find_package(my_proj), and then I have seen versions where the use file/config populated the cache for Qt/Python to the extreme where they wish me luck
What do other projects do, what is the current recommended best practice in this case?