CMake: Make Gui and some other packages optional

This allows a no-error configuration of a -no-gui Qt build. This
results in skipping building qtquickcontrols2 when Gui / Quick are not
available. qmake does the same.

Task-number: QTBUG-88343
Change-Id: I074f62e4491278ec93f1c6225923111b5eadf2ec
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-11-10 09:47:28 +01:00
parent dcfe085ba5
commit fb7d710ad0
1 changed files with 2 additions and 2 deletions

View File

@ -15,8 +15,8 @@ project(QtQuickControls2
set(QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS TRUE)
# special case end
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Gui Network Qml Quick) # special case
find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Widgets QuickTest) # special case
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Qml) # special case
find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Gui Network Quick Widgets QuickTest) # special case
if(NOT TARGET Qt::Quick)
message(NOTICE "Skipping the build as the condition \"TARGET Qt::Quick\" is not met.")
return()