cmake,UI: Refactor find_qt macro
If QT_VERSION is not defined, it gets define with the AUTO value. And its definition is moved to the helper file. find_qt now: - Check quietly for Qt5 and Qt6 - If QT_VERSION is set to AUTO. It checks firstly if Qt5 was found it will use it. If not it do the same for Qt6 - If QT_VERSION is set to 5 or 6, it checks if the choice was found and use it. And if not, it falls back to the other if found. - If neither Qt5 or Qt6 are found, a fatal error is emitted. - The macro saved the _QT_VERSION in the cache to replace QT_VERSION, so the process is not repeated each time that find_qt is used. - When Qt::Gui is in the Linux component list, Qt::GuiPrivate is added. So using the versioned one is no longer required.
This commit is contained in:
@@ -3,10 +3,7 @@ project(frontend-tools)
|
||||
add_library(frontend-tools MODULE)
|
||||
add_library(OBS::frontend-tools ALIAS frontend-tools)
|
||||
|
||||
find_qt(
|
||||
VERSION ${QT_VERSION}
|
||||
COMPONENTS Widgets
|
||||
COMPONENTS_LINUX Gui)
|
||||
find_qt(COMPONENTS Widgets COMPONENTS_LINUX Gui)
|
||||
|
||||
set_target_properties(
|
||||
frontend-tools
|
||||
@@ -49,7 +46,7 @@ target_link_libraries(frontend-tools PRIVATE OBS::frontend-api OBS::libobs
|
||||
Qt::Widgets)
|
||||
|
||||
if(OS_POSIX AND NOT OS_MACOS)
|
||||
target_link_libraries(frontend-tools PRIVATE Qt${QT_VERSION}::GuiPrivate)
|
||||
target_link_libraries(frontend-tools PRIVATE Qt::GuiPrivate)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SCRIPTING AND TARGET OBS::scripting)
|
||||
|
Reference in New Issue
Block a user