Skip to content

Commit 8e9a402

Browse files
committed
CMake: Make Network an optional package
To allow building only tools that don't depend on QtNetwork library availability. Guard building of Assistant and Designer when QtNetwork is not available. Show a warning when Assistant or Designer can't be built due to QtNetwork missing. Pick-to: 6.8 Fixes: QTBUG-127513 Change-Id: I638286cdd17ce2aff2ce990e7642cebe04b9baf9 Reviewed-by: Alexey Edelev <[email protected]>
1 parent 3a2303e commit 8e9a402

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ if(WIN32)
1818
list(APPEND optional_components AxContainer)
1919
endif()
2020

21-
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Network)
21+
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core)
2222
find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS
23-
DBus Xml Widgets Quick QuickWidgets Qml QmlLSPrivate
23+
DBus Network Xml Widgets Quick QuickWidgets Qml QmlLSPrivate
2424
Sql PrintSupport OpenGL OpenGLWidgets ${optional_components})
2525
qt_internal_project_setup()
2626

configure.cmake

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ endif()
2727
qt_feature("assistant" PRIVATE
2828
LABEL "Qt Assistant"
2929
PURPOSE "Qt Assistant is a tool for viewing on-line documentation in Qt help file format."
30-
CONDITION TARGET Qt::Widgets AND QT_FEATURE_png AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND (sqlite_plugin_available OR QT_BUILD_SHARED_LIBS)
30+
CONDITION TARGET Qt::Widgets AND TARGET Qt::Network AND QT_FEATURE_png AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND (sqlite_plugin_available OR QT_BUILD_SHARED_LIBS)
3131
)
3232
qt_feature("clang" PRIVATE
3333
LABEL "libclang found"
@@ -49,7 +49,7 @@ qt_feature("clangcpp" PRIVATE
4949
qt_feature("designer" PRIVATE
5050
LABEL "Qt Widgets Designer"
5151
PURPOSE "Qt Widgets Designer is the Qt tool for designing and building graphical user interfaces (GUIs) with Qt Widgets. You can compose and customize your windows or dialogs in a what-you-see-is-what-you-get (WYSIWYG) manner, and test them using different styles and resolutions."
52-
CONDITION TARGET Qt::Widgets AND QT_FEATURE_png AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton
52+
CONDITION TARGET Qt::Widgets AND TARGET Qt::Network AND QT_FEATURE_png AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton
5353
)
5454
qt_feature("distancefieldgenerator" PRIVATE
5555
LABEL "Qt Distance Field Generator"
@@ -151,3 +151,15 @@ qt_configure_add_report_entry(
151151
MESSAGE "${clangcpp_warn_msg}"
152152
CONDITION NOT QT_FEATURE_clangcpp
153153
)
154+
155+
qt_configure_add_report_entry(
156+
TYPE WARNING
157+
MESSAGE "Qt Assistant will not be compiled because it requires Qt Network."
158+
CONDITION NOT QT_FEATURE_assistant AND NOT TARGET Qt::Network
159+
)
160+
161+
qt_configure_add_report_entry(
162+
TYPE WARNING
163+
MESSAGE "Qt Designer will not be compiled because it requires Qt Network."
164+
CONDITION NOT QT_FEATURE_designer AND NOT TARGET Qt::Network
165+
)

0 commit comments

Comments
 (0)