aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <[email protected]>2025-09-15 14:35:35 +0200
committerAlexandru Croitor <[email protected]>2025-09-16 09:03:29 +0200
commit1e5a63f7a3a548344dca11d1ce736e2803131d2d (patch)
treed614edd994370ca4afe8094204a4c09bdbe8a9e7
parent0e45b15f10ffc4898fe3f0f233dc1a25e46af00d (diff)
CMake: Guard examples that use Svg in a qt build without Svg
Otherwise one gets errors like the following in standalone examples build: CMake Error at tools/svgtoqml/Qt6SvgToQmlMacros.cmake:65 (add_custom_command): Error evaluating generator expression: $ No target "Qt6::svgtoqml" Because the examples now use the new qt_target_qml_from_svg() function, which will try to reference a non-existent svgtoqml tool target. Change-Id: I16b10c4fa31bd73d0d95bbad371cde54f17c236a Reviewed-by: Alexey Edelev <[email protected]> Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
-rw-r--r--examples/quick/CMakeLists.txt4
-rw-r--r--examples/quick/quickshapes/CMakeLists.txt12
2 files changed, 11 insertions, 5 deletions
diff --git a/examples/quick/CMakeLists.txt b/examples/quick/CMakeLists.txt
index 8ab3ef3360..1e7adc5d66 100644
--- a/examples/quick/CMakeLists.txt
+++ b/examples/quick/CMakeLists.txt
@@ -40,7 +40,9 @@ if(TARGET Qt6::QuickWidgets AND TARGET Qt6::Widgets AND (QT_FEATURE_opengl OR QT
endif()
add_subdirectory(quickshapes)
qt_internal_add_example(advancedtext)
-qt_internal_add_example(vectorimage)
+if(TARGET Qt6::Svg)
+ qt_internal_add_example(vectorimage)
+endif()
# qt_examples_build_end() misses at least some of these due to some
# source subdirectories being added multiple times. See QTBUG-96159.
diff --git a/examples/quick/quickshapes/CMakeLists.txt b/examples/quick/quickshapes/CMakeLists.txt
index e739c3dc89..c65bee6799 100644
--- a/examples/quick/quickshapes/CMakeLists.txt
+++ b/examples/quick/quickshapes/CMakeLists.txt
@@ -1,12 +1,16 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-qt_internal_add_example(shapes)
-qt_internal_add_example(weatherforecast)
-
# qt_examples_build_end() misses at least some of these due to some
# source subdirectories being added multiple times. See QTBUG-96159.
-set(reused_dir_targets shapes_shared weatherforecast_shared)
+set(reused_dir_targets shapes_shared)
+
+qt_internal_add_example(shapes)
+
+if(TARGET Qt6::Svg)
+ list(APPEND reused_dir_targets weatherforecast_shared)
+ qt_internal_add_example(weatherforecast)
+endif()
foreach(target IN LISTS reused_dir_targets)
if(TARGET ${target})