Standalone test projects have the following condition in the beginning of their project: if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) find_package(Qt6BuildInternals COMPONENT STANDALONE_TEST) endif() When configuring the project the first time, QT_BUILDING_QT is not set, find_package is called, configuration succeeds. But because standalone projects implicitly include QtSetup.cmake, that file sets the QT_BUILDING_QT cache var to true, and upon test reconfiguration, cmake errors out with: Unknown CMake command "qt_internal_add_test" or similar. This happens because QT_BUILDING_QT is true on the second reconfiguration and the find_package mentioned above is not executed anymore, leading to unknown internal command errors. Set a new QT_INTERNAL_IS_STANDALONE_TEST variable when we detect a standalone test and check for its value in QtSetup so we don't set QT_BUILDING_QT to TRUE anymore. Adjust a few code locations where QT_BUILDING_QT being false might trigger different behavior for standalone tests. Task-number: QTBUG-93020 Change-Id: I5413b9f37653225175a1006f7626e023045b5979 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> (cherry picked from commit b9b5ed3aa607f644cf32b5798ac742442de9fe3e)
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%