QRangeModel/Doc: link to QtWidgets only if the feature is set

Amends efe41182fda94c0e4805c24b3305577e5da81880.

The code already tests for QT_NO_WIDGETS before including and using
Widgets APIs, and we will want to extend the corelib_snippets target
with more of the existing snippets code to make sure that they build.

To not break -no-widgets builds, don't link against Qt::Widgets unless
the feature is set.

Pick-to: 6.10
Fixes: QTBUG-137556
Change-Id: Ic30fd519416068c275c3fffd0e1df10a76ce8fad
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Thiago Macieira 2025-06-11 08:55:14 -07:00 committed by Volker Hilsheimer
parent 45202b26ce
commit 07d3d3935c

View File

@ -9,11 +9,10 @@ target_link_libraries(corelib_snippets PRIVATE
Qt::Core
)
if (TARGET Qt::Widgets)
target_link_libraries(corelib_snippets PRIVATE
qt_internal_extend_target(corelib_snippets CONDITION QT_FEATURE_widgets
LIBRARIES
Qt::Widgets
)
endif()
)
if ("${CMAKE_CXX_COMPILE_FEATURES}" MATCHES "cxx_std_23")
set_property(TARGET corelib_snippets PROPERTY CXX_STANDARD 23)