CMake: Don't recurse with qt-cmake-standalone-test in-source dirs
When the qt-cmake-standalone-test root project is configured in-source in the source directory of a test A, where test A ends up being added via add_subdirectory(A), this causes the SUBDIRECTORIES property of A to contain itself for some reason. Recursively iterating over the root project's subdirectories thus causes an endless recursion. Make sure to remove the currently processed directory from the retrieved SUBDIRECTORIES property when the function is called during qt-cmake-standalone-test configuration. We limit it just for that script, so that we don't accidentally increase the configure time when building all standalone tests, and call list(REMOVE_ITEM) too many times. Upstream issue filed at https://gitlab.kitware.com/cmake/cmake/-/issues/25489 In a way, amends d08fa86e63448377dde4297bc94680a9d7daaaeb because it exposed the issue. Amends 1c82e92202c8c359872c08095670c121602094b8 Pick-to: 6.5 6.6 6.7 Task-number: QTBUG-119998 Change-Id: I6f92a07be105cde74ac4946523967791db7bf301 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
0441526448
commit
04a327f00a
@ -117,6 +117,18 @@ function(_qt_internal_collect_buildsystem_targets result dir)
|
||||
endif()
|
||||
|
||||
get_property(subdirs DIRECTORY "${dir}" PROPERTY SUBDIRECTORIES)
|
||||
|
||||
# Make sure that we don't hit endless recursion when running qt-cmake-standalone-test on a
|
||||
# in-source test dir, where the currently processed directory lists itself in its SUBDIRECTORIES
|
||||
# property.
|
||||
# See https://bugreports.qt.io/browse/QTBUG-119998
|
||||
# and https://gitlab.kitware.com/cmake/cmake/-/issues/25489
|
||||
# Do it only when QT_INTERNAL_IS_STANDALONE_TEST is set, to avoid the possible slowdown when
|
||||
# processing many subdirectores when configuring all standalone tests rather than just one.
|
||||
if(QT_INTERNAL_IS_STANDALONE_TEST)
|
||||
list(REMOVE_ITEM subdirs "${dir}")
|
||||
endif()
|
||||
|
||||
foreach(subdir IN LISTS subdirs)
|
||||
_qt_internal_collect_buildsystem_targets(${result} "${subdir}" ${forward_args})
|
||||
endforeach()
|
||||
|
Loading…
x
Reference in New Issue
Block a user