mirror of https://github.com/qt/qtbase.git
CMake: Always execute qt_find_package(MODULE) calls
A qt_find_package(Foo MODULE) call is only executed if Foo_FOUND is 0, otherwise it is skipped. This is problematic for FindFoo scripts that are implemented using pkg_check_modules calls which specify a <prefix> that matches the package name (Foo), because pkg_check_modules then sets the Foo_FOUND cache var to 1. On reconfiguration Foo_FOUND is 1, the qt_find_package call is skipped, and thus no targets are created, which can lead to 'unknown target' errors. The fact that pkg_check_modules sets a cache var, rather than a local var is a CMake issue: https://gitlab.kitware.com/cmake/cmake/-/issues/27014 One workaround would be to modify all our Find scripts to use a <prefix> that does not match the package name, so the _FOUND cache var is not set. That is somewhat error prone though, and requires some effort. Until CMake changes its behavior, make sure we always run qt_find_package(MODULE) calls, even if the cache var is set as found. Pick-to: 6.10 Task-number: QTBUG-137870 Change-Id: Ifad8807fd69a65be8e338695b9002760c6d97461 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
46b2a0c1b6
commit
36a375ff4c
|
@ -136,7 +136,7 @@ macro(qt_find_package)
|
|||
# TODO: Handle packages with components where a previous component is already found.
|
||||
# E.g. find_package(Qt6 COMPONENTS BuildInternals) followed by
|
||||
# qt_find_package(Qt6 COMPONENTS Core) doesn't end up calling find_package(Qt6Core).
|
||||
if (NOT ${ARGV0}_FOUND AND NOT _qt_find_package_skip_find_package)
|
||||
if ((NOT ${ARGV0}_FOUND OR arg_MODULE) AND NOT _qt_find_package_skip_find_package)
|
||||
# Call original function without our custom arguments.
|
||||
find_package(${arg_UNPARSED_ARGUMENTS})
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue