Skip to content

Commit

Permalink
CMake: Make Network an optional package
Browse files Browse the repository at this point in the history
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 <alexey.edelev@qt.io>
  • Loading branch information
alcroito committed Jul 26, 2024
1 parent 3a2303e commit 8e9a402
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ if(WIN32)
list(APPEND optional_components AxContainer)
endif()

find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Network)
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core)
find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS
DBus Xml Widgets Quick QuickWidgets Qml QmlLSPrivate
DBus Network Xml Widgets Quick QuickWidgets Qml QmlLSPrivate
Sql PrintSupport OpenGL OpenGLWidgets ${optional_components})
qt_internal_project_setup()

Expand Down
16 changes: 14 additions & 2 deletions configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ endif()
qt_feature("assistant" PRIVATE
LABEL "Qt Assistant"
PURPOSE "Qt Assistant is a tool for viewing on-line documentation in Qt help file format."
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)
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)
)
qt_feature("clang" PRIVATE
LABEL "libclang found"
Expand All @@ -49,7 +49,7 @@ qt_feature("clangcpp" PRIVATE
qt_feature("designer" PRIVATE
LABEL "Qt Widgets Designer"
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."
CONDITION TARGET Qt::Widgets AND QT_FEATURE_png AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton
CONDITION TARGET Qt::Widgets AND TARGET Qt::Network AND QT_FEATURE_png AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton
)
qt_feature("distancefieldgenerator" PRIVATE
LABEL "Qt Distance Field Generator"
Expand Down Expand Up @@ -151,3 +151,15 @@ qt_configure_add_report_entry(
MESSAGE "${clangcpp_warn_msg}"
CONDITION NOT QT_FEATURE_clangcpp
)

qt_configure_add_report_entry(
TYPE WARNING
MESSAGE "Qt Assistant will not be compiled because it requires Qt Network."
CONDITION NOT QT_FEATURE_assistant AND NOT TARGET Qt::Network
)

qt_configure_add_report_entry(
TYPE WARNING
MESSAGE "Qt Designer will not be compiled because it requires Qt Network."
CONDITION NOT QT_FEATURE_designer AND NOT TARGET Qt::Network
)

0 comments on commit 8e9a402

Please sign in to comment.