From 253a7f95bca62760a6beb0acb4eb9966ebbd113e Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 15 Aug 2025 19:03:48 +0200 Subject: CMake: Don't use private CMake API in doc snippets Private CMake API like qt_internal_extend_target should not be used in public doc snippets. While most of the CMakeLists.txt doc snippets might not appear in the documentation right now, they might in the future (just like the CMake API doc snippets). In addition, using private CMake API for doc snippets targets causes issues with SBOM generation, because the original targets are not created with private API (e.g. qt_internal_add_module vs qt_add_library), and thus important sbom meta information is missing, causing errors at cmake configure time when sbom generation is enabled. Pick-to: 6.8 6.9 6.10 Change-Id: I2ef80f617ba8b745520408d22dd2e6be5ee4c5e0 Reviewed-by: Oleksii Zbykovskyi Reviewed-by: Joerg Bornemann --- src/testlib/doc/snippets/code/CMakeLists.txt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/testlib/doc/snippets') diff --git a/src/testlib/doc/snippets/code/CMakeLists.txt b/src/testlib/doc/snippets/code/CMakeLists.txt index 54c655a5214..2df704b83e0 100644 --- a/src/testlib/doc/snippets/code/CMakeLists.txt +++ b/src/testlib/doc/snippets/code/CMakeLists.txt @@ -11,18 +11,22 @@ target_link_libraries(testlib_code_snippets PRIVATE Qt::Test ) -qt_internal_extend_target(testlib_code_snippets CONDITION QT_FEATURE_gui AND QT_FEATURE_sql - SOURCES +if(QT_FEATURE_gui AND QT_FEATURE_sql) + target_sources(testlib_code_snippets PRIVATE doc_src_qtestlib.cpp - PUBLIC_LIBRARIES + ) + target_link_libraries(testlib_code_snippets PUBLIC Qt::Gui Qt::Sql -) + ) +endif() -qt_internal_extend_target(testlib_code_snippets CONDITION QT_FEATURE_widgets - SOURCES +if(QT_FEATURE_widgets) + target_sources(testlib_code_snippets PRIVATE doc_src_qtestevent.cpp doc_src_qtestevent.h - PUBLIC_LIBRARIES + ) + target_link_libraries(testlib_code_snippets PUBLIC Qt::Widgets -) + ) +endif() -- cgit v1.2.3