In prefix builds of non-qtbase repositories, calls to find_package(Qt6
COMPONENT Foo) did not work in tests, because the find_package calls in
Qt6Config.cmake use NO_DEFAULT_PATH, and thus CMAKE_PREFIX_PATH is
ignored.
Non-external-project examples had the same problem. This was fixed by
ffe0889413 which introduced the variable
QT_EXAMPLES_CMAKE_PREFIX_PATH as additional parameter in all relevant
find_package calls.
We now set this variable in qt_build_tests where it should be local to
the tests directory and its children.
We cannot use QT_ADDITIONAL_PACKAGES_PREFIX_PATH, because it's value is
read once and cached in Qt6Config.cmake - we would have to clear the
internal cache variable.
It would probably be good to rename QT_EXAMPLES_CMAKE_PREFIX_PATH to
reflect that it's not just used for examples. However, my naming skills
are drained for today.
Task-number: QTBUG-88264
Change-Id: I8bcfe9b7f2ee1f1b75dc725977924d09cb36822c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>