CMake build: Avoid endless loop if plugin does not exist

get_property fails if the target does not exist, and _dep stays at some
old value.

This leads to a) a lot of cmake backtraces with an error message that
doesn't add anything useful, and b) an endless loop in
find_dependent_plugins. Which in the end leads to 500.000 lines of
useless CMake output, repeating
"qtcreator/cmake/QtCreatorAPIInternal.cmake:340 (find_dependent_plugins)"

Skip get_property if the target doesn't exist.

Change-Id: Ic694bc05b3dce5b83220a2f5dab8f063ef692c12
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Eike Ziller
2022-05-10 13:48:38 +02:00
parent 6b781b4fe9
commit 57a69d9d0b

View File

@@ -295,6 +295,10 @@ function(find_dependent_plugins varName)
set(_RESULT ${ARGN}) set(_RESULT ${ARGN})
foreach(i ${ARGN}) foreach(i ${ARGN})
if(NOT TARGET ${i})
continue()
endif()
set(_dep)
get_property(_dep TARGET "${i}" PROPERTY _arg_DEPENDS) get_property(_dep TARGET "${i}" PROPERTY _arg_DEPENDS)
if (_dep) if (_dep)
find_dependent_plugins(_REC ${_dep}) find_dependent_plugins(_REC ${_dep})