diff options
author | Kai Köhne <kai.koehne@qt.io> | 2023-10-05 09:42:12 +0200 |
---|---|---|
committer | Kai Köhne <kai.koehne@qt.io> | 2023-10-11 12:30:08 +0200 |
commit | b9c23d0d59d455f6660b13e6430eacb0901a9a35 (patch) | |
tree | 2c49ffef31917efadb88b278f0072d8eec214999 | |
parent | 5b5cdfa121955be8b3b2a8d5593ae73dccc190f6 (diff) |
Fix top-level qt5 -no-gui build
Gracefully handle the case where Multimedia is not available.
Also, as we now centrally check for Multimedia availability,
remove the individual checks.
Pick-to: 6.6
Fixes: QTBUG-117824
Change-Id: If40c7f98f1dfa48c91f504dbdf657067044860c3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r-- | CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/plugins/tts/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/tts/configure.cmake | 10 | ||||
-rw-r--r-- | tests/auto/qtexttospeech/CMakeLists.txt | 5 |
4 files changed, 12 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1993c67..8ceead0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,8 +13,14 @@ project(QtSpeech LANGUAGES CXX C ) -find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Multimedia) -find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS Gui Widgets Test QuickTest Qml) +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) +find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS Gui Multimedia Widgets Test QuickTest Qml) + +if(NOT TARGET Qt6::Multimedia) + message(NOTICE "Skipping the build as the condition \"TARGET Qt6::Multimedia\" is not met.") + return() +endif() + qt_internal_project_setup() qt_build_repo() diff --git a/src/plugins/tts/CMakeLists.txt b/src/plugins/tts/CMakeLists.txt index 5cd806d..ef7a2a0 100644 --- a/src/plugins/tts/CMakeLists.txt +++ b/src/plugins/tts/CMakeLists.txt @@ -7,7 +7,7 @@ if(QT_FEATURE_speechd AND UNIX) endif() if(WIN32) add_subdirectory(sapi) - if(TARGET Qt::Multimedia AND NOT MINGW) + if(NOT MINGW) add_subdirectory(winrt) endif() endif() @@ -20,6 +20,6 @@ endif() if(ANDROID) add_subdirectory(android) endif() -if(QT_FEATURE_flite AND TARGET Qt::Multimedia) +if(QT_FEATURE_flite) add_subdirectory(flite) endif() diff --git a/src/tts/configure.cmake b/src/tts/configure.cmake index 6484a24..c31d275 100644 --- a/src/tts/configure.cmake +++ b/src/tts/configure.cmake @@ -20,19 +20,13 @@ qt_find_package(SpeechDispatcher PROVIDED_TARGETS SpeechDispatcher::SpeechDispat #### Features -if (Flite_FOUND AND NOT TARGET Qt::Multimedia) - message(WARNING - "Flite was found, but Qt::Multimedia is not configured.\n" - "The Flite engine will be disabled.") -endif() - qt_feature("flite" PRIVATE LABEL "Flite" - CONDITION Flite_FOUND AND TARGET Qt::Multimedia + CONDITION Flite_FOUND ) qt_feature("flite_alsa" PRIVATE LABEL "Flite with ALSA" - CONDITION Flite_FOUND AND ALSA_FOUND AND TARGET Qt::Multimedia + CONDITION Flite_FOUND AND ALSA_FOUND ) qt_feature("speechd" PUBLIC LABEL "Speech Dispatcher" diff --git a/tests/auto/qtexttospeech/CMakeLists.txt b/tests/auto/qtexttospeech/CMakeLists.txt index 99ee37d..03fdf4f 100644 --- a/tests/auto/qtexttospeech/CMakeLists.txt +++ b/tests/auto/qtexttospeech/CMakeLists.txt @@ -1,11 +1,6 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -if(NOT TARGET Qt::Multimedia) - message(WARNING "The test case requires Qt::Multimedia to verify the presence of audio devices") - return() -endif() - qt_internal_add_test(tst_qtexttospeech SOURCES tst_qtexttospeech.cpp |