From 9cd7d8306901946c3eeed3375940cee2949c1ba7 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Fri, 9 Apr 2021 12:56:23 +0200 Subject: [PATCH] Check if all required Qt targets are declared when finalizing the module CMake makes possible to specify a target in the target_link_library call even if the target is not declared yet. This adds flexibility to the target declaration arrangement. For the Qt modules we have to restrict freedom, because of the .prl files generating. If the Qt module depends on another Qt module, the dependecy must be declared before the module finalizing step, otherwise this will cause invalid records in the module .prl file. TODO: The dependency order issue could be solved by using conditional genex's when generating step1 .prl file. But we ask developers to depend on Qt module targets that have been defined before their usage. Fixes: QTBUG-89467 Change-Id: I12ce1000048fd4a2f3334f17720c8df1c680ca20 Reviewed-by: Alexandru Croitor --- cmake/QtPrlHelpers.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/QtPrlHelpers.cmake b/cmake/QtPrlHelpers.cmake index 0aab301053c..29555f1fb35 100644 --- a/cmake/QtPrlHelpers.cmake +++ b/cmake/QtPrlHelpers.cmake @@ -225,6 +225,9 @@ function(qt_internal_walk_libs set_property(TARGET ${lib_target_unaliased} PROPERTY IMPORTED_GLOBAL TRUE) endif() endif() + elseif("${lib_target}" MATCHES "^Qt::(.*)") + message(FATAL_ERROR "The ${CMAKE_MATCH_1} target is mentioned as a dependency for \ +${target}, but not declared.") else() set(final_lib_name_to_merge "${lib_target}") if(lib_target MATCHES "/([^/]+).framework$")