Skip to content

Commit

Permalink
cmake: Remove find_qt macro
Browse files Browse the repository at this point in the history
We no longer need this functionality in the new CMake paths. It is still
available in the legacy CMake path.
  • Loading branch information
RytoEX committed Apr 18, 2024
1 parent 3cbe864 commit 8a7ad10
Showing 1 changed file with 0 additions and 46 deletions.
46 changes: 0 additions & 46 deletions cmake/common/helpers_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -107,52 +107,6 @@ function(target_disable target)
set_property(GLOBAL APPEND PROPERTY OBS_MODULES_DISABLED ${target})
endfunction()

# find_qt: Macro to find best possible Qt version for use with the project:
macro(find_qt)
set(multiValueArgs COMPONENTS COMPONENTS_WIN COMPONENTS_MAC COMPONENTS_LINUX)
cmake_parse_arguments(find_qt "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

# Do not use versionless targets in the first step to avoid Qt::Core being clobbered by later opportunistic
# find_package runs
set(QT_NO_CREATE_VERSIONLESS_TARGETS TRUE)

message(DEBUG "Attempting to find Qt 6")
find_package(
Qt6
COMPONENTS Core
REQUIRED)

# Enable versionless targets for the remaining Qt components
set(QT_NO_CREATE_VERSIONLESS_TARGETS FALSE)

set(qt_components ${find_qt_COMPONENTS})
if(OS_WINDOWS)
list(APPEND qt_components ${find_qt_COMPONENTS_WIN})
elseif(OS_MACOS)
list(APPEND qt_components ${find_qt_COMPONENTS_MAC})
else()
list(APPEND qt_components ${find_qt_COMPONENTS_LINUX})
endif()
message(DEBUG "Trying to find Qt components ${qt_components}...")

find_package(Qt6 REQUIRED ${qt_components})

list(APPEND qt_components Core)

if("Gui" IN_LIST find_qt_COMPONENTS_LINUX)
list(APPEND qt_components "GuiPrivate")
endif()

# Check for versionless targets of each requested component and create if necessary
foreach(component IN LISTS qt_components)
message(DEBUG "Checking for target Qt::${component}")
if(NOT TARGET Qt::${component} AND TARGET Qt6::${component})
add_library(Qt::${component} INTERFACE IMPORTED)
set_target_properties(Qt::${component} PROPERTIES INTERFACE_LINK_LIBRARIES Qt6::${component})
endif()
endforeach()
endmacro()

# _handle_generator_expression_dependency: Helper function to yield dependency from a generator expression
function(_handle_generator_expression_dependency library)
set(oneValueArgs FOUND_VAR)
Expand Down

0 comments on commit 8a7ad10

Please sign in to comment.