From 45ab6b8cd272eb2ec0ecd8c3f17b23d9f512b43a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8ger=20Hanseg=C3=A5rd?= Date: Mon, 25 Nov 2024 21:03:12 +0100 Subject: [PATCH] Only call find_package when building tests as standalone This allows us to build manual tests together with Qt by specifying QT_BUILD_MANUAL_TESTS and QT_BUILD_TESTS. A benefit of doing this, is that the manual tests show up as debuggable targets with IDEs such as Visual Studio Code, while keeping full code navigation capabilities into the Qt code. Pick-to: 6.8 Change-Id: Idd309c06fb2586fd634386951a3345aa40bc093a Reviewed-by: Even Oscar Andersen Reviewed-by: Alexandru Croitor --- tests/manual/consolepubsub/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/manual/consolepubsub/CMakeLists.txt b/tests/manual/consolepubsub/CMakeLists.txt index 761aa15..cdf0d07 100644 --- a/tests/manual/consolepubsub/CMakeLists.txt +++ b/tests/manual/consolepubsub/CMakeLists.txt @@ -16,7 +16,9 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/mqtt/consolepubsub") -find_package(Qt6 REQUIRED COMPONENTS Mqtt) +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + find_package(Qt6 REQUIRED COMPONENTS Mqtt) +end() # # Pub