Skip to content

Commit 4704e39

Browse files
alcroitoQt Cherry-pick Bot
authored andcommitted
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. Fixes: QTBUG-127513 Change-Id: I638286cdd17ce2aff2ce990e7642cebe04b9baf9 Reviewed-by: Alexey Edelev <[email protected]> (cherry picked from commit 8e9a402) Reviewed-by: Qt Cherry-pick Bot <[email protected]>
1 parent d5c328f commit 4704e39

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
@@ -42,7 +42,7 @@ endif()
4242
qt_feature("assistant" PRIVATE
4343
LABEL "Qt Assistant"
4444
PURPOSE "Qt Assistant is a tool for viewing on-line documentation in Qt help file format."
45-
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)
45+
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)
4646
)
4747
qt_feature("clang" PRIVATE
4848
LABEL "libclang found"
@@ -64,7 +64,7 @@ qt_feature("clangcpp" PRIVATE
6464
qt_feature("designer" PRIVATE
6565
LABEL "Qt Widgets Designer"
6666
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."
67-
CONDITION TARGET Qt::Widgets AND QT_FEATURE_png AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton
67+
CONDITION TARGET Qt::Widgets AND TARGET Qt::Network AND QT_FEATURE_png AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton
6868
)
6969
qt_feature("distancefieldgenerator" PRIVATE
7070
LABEL "Qt Distance Field Generator"
@@ -166,3 +166,15 @@ qt_configure_add_report_entry(
166166
MESSAGE "${clangcpp_warn_msg}"
167167
CONDITION NOT QT_FEATURE_clangcpp
168168
)
169+
170+
qt_configure_add_report_entry(
171+
TYPE WARNING
172+
MESSAGE "Qt Assistant will not be compiled because it requires Qt Network."
173+
CONDITION NOT QT_FEATURE_assistant AND NOT TARGET Qt::Network
174+
)
175+
176+
qt_configure_add_report_entry(
177+
TYPE WARNING
178+
MESSAGE "Qt Designer will not be compiled because it requires Qt Network."
179+
CONDITION NOT QT_FEATURE_designer AND NOT TARGET Qt::Network
180+
)

0 commit comments

Comments
 (0)