cmake: Replace custom Qt discovery function with CMake default

find_qt was necessary during the transitional period between Qt5 and
Qt6. With Qt6 being the only supported Qt version (for open source) for
the time being, code complexity can be reduced for easier maintenance.
This commit is contained in:
PatTheMav 2023-09-02 17:00:37 +02:00 committed by Ryan Foster
parent 7931f2acb8
commit 8135085a23
8 changed files with 33 additions and 9 deletions

View file

@ -1,4 +1,10 @@
find_qt(COMPONENTS Widgets Network Svg Xml COMPONENTS_LINUX Gui)
# cmake-format: off
find_package(Qt6 REQUIRED Widgets Network Svg Xml)
# cmake-format: on
if(NOT OS_WINDOWS AND NOT OS_MACOS)
find_package(Qt6 REQUIRED Gui)
endif()
target_link_libraries(obs-studio PRIVATE Qt::Widgets Qt::Svg Qt::Xml Qt::Network)

View file

@ -8,7 +8,13 @@ if(NOT ENABLE_AJA)
endif()
find_package(LibAJANTV2 REQUIRED)
find_qt(COMPONENTS Widgets COMPONENTS_LINUX Gui)
# cmake-format: off
find_package(Qt6 REQUIRED Widgets)
if(OS_LINUX)
find_package(Qt6 REQUIRED Gui)
endif()
# cmake-format: on
add_library(aja-output-ui MODULE)
add_library(OBS::aja-output-ui ALIAS aja-output-ui)

View file

@ -7,7 +7,9 @@ if(NOT ENABLE_DECKLINK)
return()
endif()
find_qt(COMPONENTS Widgets)
# cmake-format: off
find_package(Qt6 REQUIRED Widgets)
# cmake-format: on
add_library(decklink-captions MODULE)
add_library(OBS::decklink-captions ALIAS decklink-captions)

View file

@ -7,7 +7,12 @@ if(NOT ENABLE_DECKLINK)
return()
endif()
find_qt(COMPONENTS Widgets COMPONENTS_LINUX Gui)
# cmake-format: off
find_package(Qt6 REQUIRED Widgets)
if (OS_LINUX)
find_package(Qt6 REQUIRED Gui)
endif()
# cmake-format: on
add_library(decklink-output-ui MODULE)
add_library(OBS::decklink-output-ui ALIAS decklink-output-ui)

View file

@ -2,7 +2,12 @@ cmake_minimum_required(VERSION 3.22...3.25)
legacy_check()
find_qt(COMPONENTS Widgets COMPONENTS_LINUX Gui)
# cmake-format: off
find_package(Qt6 REQUIRED Widgets)
if (OS_LINUX)
find_package(Qt6 REQUIRED Gui)
endif()
# cmake-format: on
add_library(frontend-tools MODULE)
add_library(OBS::frontend-tools ALIAS frontend-tools)

View file

@ -263,8 +263,8 @@ function(find_qt_plugins)
list(GET library_tuple 0 library_namespace)
list(GET library_tuple 1 library_name)
if(NOT ${library_namespace} MATCHES "Qt[56]?")
message(FATAL_ERROR "'find_qt_plugins' has to be called with a valid target from the Qt, Qt5, or Qt6 namespace.")
if(NOT ${library_namespace} MATCHES "Qt6?")
message(FATAL_ERROR "'find_qt_plugins' has to be called with a valid target from the Qt or Qt6 namespace.")
endif()
list(

View file

@ -18,7 +18,7 @@ find_package(FFmpeg REQUIRED avformat avutil swscale swresample OPTIONAL_COMPONE
find_package(ZLIB REQUIRED)
if(ENABLE_UI)
find_qt(COMPONENTS Core)
find_package(Qt6 REQUIRED Core)
endif()
find_package(jansson REQUIRED)

View file

@ -12,7 +12,7 @@ endif()
add_library(obs-vst MODULE)
add_library(OBS::vst ALIAS obs-vst)
find_qt(COMPONENTS Widgets)
find_package(Qt6 REQUIRED Widgets)
target_sources(
obs-vst