Make find_package in configure.cmake a hard error

qt3d/9a473a3c9b246f4895ae73d7060745b8b199a6c5 introduced a find_package
call in a configure.cmake file, very subtly breaking top-level builds
with configure.

The find_package call results in errors of the cmake call that runs
QtProcessConfigureArgs.cmake (see bug report for details).

Create a find_package stub that errors out with a helpful message.

Task-number: QTBUG-92163
Change-Id: I06db0bf219b965e93b78c690e9f7ad868196ddb9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2021-03-25 21:24:52 +01:00
parent 293d556fb4
commit f64ccc5f53

View File

@ -114,6 +114,11 @@ function(qt_feature feature)
set_property(GLOBAL PROPERTY COMMANDLINE_FEATURE_SECTION_${feature} "${arg_SECTION}")
endfunction()
function(find_package)
message(FATAL_ERROR "find_package must not be used directly in configure.cmake. "
"Use qt_find_package or guard the call with an if(NOT QT_CONFIGURE_RUNNING) block.")
endfunction()
macro(defstub name)
function(${name})
endfunction()