Skip to content

Commit a1289fd

Browse files
committed
cmake: Replace find_qt with find_package
We currently no longer need this functionality.
1 parent e460869 commit a1289fd

File tree

3 files changed

+2
-59
lines changed

3 files changed

+2
-59
lines changed

.cmake-format.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@
66
"autosort": true
77
},
88
"additional_commands": {
9-
"find_qt": {
10-
"flags": [],
11-
"kwargs": {
12-
"COMPONENTS": "+",
13-
"COMPONENTS_WIN": "+",
14-
"COMPONENTS_MACOS": "+",
15-
"COMPONENTS_LINUX": "+"
16-
}
17-
},
189
"set_target_properties_obs": {
1910
"pargs": 1,
2011
"flags": [],

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ if(ENABLE_FRONTEND_API)
2222
endif()
2323

2424
if(ENABLE_QT)
25-
find_qt(COMPONENTS Widgets Core)
26-
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Qt::Core Qt::Widgets)
25+
find_package(Qt6 COMPONENTS Widgets Core)
26+
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Qt6::Core Qt6::Widgets)
2727
target_compile_options(
2828
${CMAKE_PROJECT_NAME} PRIVATE $<$<C_COMPILER_ID:Clang,AppleClang>:-Wno-quoted-include-in-framework-header
2929
-Wno-comma>)

cmake/common/helpers_common.cmake

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,6 @@
66

77
include_guard(GLOBAL)
88

9-
# find_qt: Macro to find best possible Qt version for use with the project:
10-
macro(find_qt)
11-
set(multiValueArgs COMPONENTS COMPONENTS_WIN COMPONENTS_MAC COMPONENTS_LINUX)
12-
cmake_parse_arguments(find_qt "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
13-
14-
# Do not use versionless targets in the first step to avoid Qt::Core being clobbered by later opportunistic
15-
# find_package runs
16-
set(QT_NO_CREATE_VERSIONLESS_TARGETS TRUE)
17-
18-
message(DEBUG "Attempting to find Qt 6")
19-
find_package(
20-
Qt6
21-
COMPONENTS Core
22-
REQUIRED)
23-
24-
# Enable versionless targets for the remaining Qt components
25-
set(QT_NO_CREATE_VERSIONLESS_TARGETS FALSE)
26-
27-
set(qt_components ${find_qt_COMPONENTS})
28-
if(OS_WINDOWS)
29-
list(APPEND qt_components ${find_qt_COMPONENTS_WIN})
30-
elseif(OS_MACOS)
31-
list(APPEND qt_components ${find_qt_COMPONENTS_MAC})
32-
else()
33-
list(APPEND qt_components ${find_qt_COMPONENTS_LINUX})
34-
endif()
35-
message(DEBUG "Trying to find Qt components ${qt_components}...")
36-
37-
find_package(Qt6 REQUIRED ${qt_components})
38-
39-
list(APPEND qt_components Core)
40-
41-
if("Gui" IN_LIST find_qt_COMPONENTS_LINUX)
42-
list(APPEND qt_components "GuiPrivate")
43-
endif()
44-
45-
# Check for versionless targets of each requested component and create if necessary
46-
foreach(component IN LISTS qt_components)
47-
message(DEBUG "Checking for target Qt::${component}")
48-
if(NOT TARGET Qt::${component} AND TARGET Qt6::${component})
49-
add_library(Qt::${component} INTERFACE IMPORTED)
50-
set_target_properties(Qt::${component} PROPERTIES INTERFACE_LINK_LIBRARIES Qt6::${component})
51-
endif()
52-
set_property(TARGET Qt::${component} PROPERTY INTERFACE_COMPILE_FEATURES "")
53-
endforeach()
54-
55-
endmacro()
56-
579
# check_uuid: Helper function to check for valid UUID
5810
function(check_uuid uuid_string return_value)
5911
set(valid_uuid TRUE)

0 commit comments

Comments
 (0)