Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake: Don't set QT_BUILDING_QT for single standalone tests
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 <[email protected]> Reviewed-by: Joerg Bornemann <[email protected]> Reviewed-by: Thiago Macieira <[email protected]> Reviewed-by: Amir Masoud Abdol <[email protected]>
- Loading branch information