From a9f26c3f9a9eb6758e3ef116e319a6cca8715a1c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 28 Feb 2025 10:12:48 +0100 Subject: [PATCH] CMake: Fix building tests with qt-cmake-standalone-test We now require user projects to use find_package(Qt6FooPrivate) if the Qt6::FooPrivate target is used. We don't require this for Qt's autotests. But configuring such a test with qt-cmake-standalone-test failed. Fix this by setting QT_FIND_PRIVATE_MODULES to ON in the CMake project template for standalone tests. Change-Id: I778cbfc16638a94b5fe538c175394501df106b82 Reviewed-by: Alexey Edelev --- .../QtStandaloneTestTemplateProject/Main.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake b/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake index fe33fb4b554..2ab2a7f1cdf 100644 --- a/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake +++ b/cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake @@ -4,6 +4,9 @@ # Includes QtSetup and friends for private CMake API. set(QT_INTERNAL_IS_STANDALONE_TEST TRUE) +# Make find_package(Qt6 COMPONENTS Foo) pull in FooPrivate too. +set(QT_FIND_PRIVATE_MODULES TRUE) + # Checks minimum CMake version and upgrades policies. qt_internal_project_setup()