Skip to content

Commit 1ff9ca4

Browse files
committed
qt: Default to Qt 6 instead of Qt 5
1 parent 1e99596 commit 1ff9ca4

File tree

2 files changed

+26
-37
lines changed

2 files changed

+26
-37
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ if (use_sys_sqlite3)
7676
find_package(SQLite3 REQUIRED)
7777
endif()
7878
if (build_wizard)
79-
if (force_qt STREQUAL "Qt6")
79+
if (NOT force_qt STREQUAL "Qt5")
8080
if (CMAKE_SYSTEM MATCHES "Darwin")
8181
set(MACOS_VERSION_MIN 10.15)
8282
endif()

addon/doxywizard/CMakeLists.txt

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,40 @@
1-
if (force_qt STREQUAL "Qt5" OR NOT force_qt)
2-
find_package(Qt5Core QUIET CONFIG)
3-
if (Qt5Core_FOUND)
4-
message(STATUS "Using Qt5")
5-
find_package(Qt5 COMPONENTS Widgets Gui Xml)
6-
macro(qt_wrap_cpp)
7-
qt5_wrap_cpp(${ARGN})
8-
endmacro()
9-
macro(qt_add_resources)
10-
qt5_add_resources(${ARGN})
11-
endmacro()
12-
else()
13-
if (NOT force_qt)
14-
find_package(Qt6Core QUIET CONFIG)
15-
if (Qt6Core_FOUND)
16-
message(STATUS "Using Qt6")
17-
find_package(Qt6 COMPONENTS Widgets Gui Xml)
18-
macro(qt_wrap_cpp)
19-
qt6_wrap_cpp(${ARGN})
20-
endmacro()
21-
macro(qt_add_resources)
22-
qt6_add_resources(${ARGN})
23-
endmacro()
24-
else()
25-
message(FATAL_ERROR "Qt5 nor Qt6 found")
26-
endif()
27-
else()
28-
message(FATAL_ERROR "Qt5 not found")
29-
endif()
30-
endif()
31-
else()
1+
# Try finding Qt6
2+
if (force_qt STREQUAL "Qt6" OR NOT force_qt)
323
find_package(Qt6Core QUIET CONFIG)
334
if (Qt6Core_FOUND)
345
message(STATUS "Using Qt6")
35-
find_package(Qt6 COMPONENTS Widgets Gui Xml)
6+
find_package(Qt6 REQUIRED COMPONENTS Widgets Gui Xml)
367
macro(qt_wrap_cpp)
378
qt6_wrap_cpp(${ARGN})
389
endmacro()
3910
macro(qt_add_resources)
4011
qt6_add_resources(${ARGN})
4112
endmacro()
42-
else()
13+
elseif (force_qt STREQUAL "Qt6")
14+
# no fallback to Qt5
4315
message(FATAL_ERROR "Qt6 not found")
4416
endif()
4517
endif()
4618

19+
# Try finding Qt5
20+
if (force_qt STREQUAL "Qt5" OR NOT Qt6_FOUND)
21+
find_package(Qt5Core QUIET CONFIG)
22+
if (Qt5Core_FOUND)
23+
message(STATUS "Using Qt5")
24+
find_package(Qt5 REQUIRED COMPONENTS Widgets Gui Xml)
25+
macro(qt_wrap_cpp)
26+
qt5_wrap_cpp(${ARGN})
27+
endmacro()
28+
macro(qt_add_resources)
29+
qt5_add_resources(${ARGN})
30+
endmacro()
31+
elseif (force_qt STREQUAL "Qt5")
32+
message(FATAL_ERROR "Qt5 not found")
33+
else()
34+
message(FATAL_ERROR "Qt5 nor Qt6 found")
35+
endif()
36+
endif()
37+
4738
include_directories(
4839
.
4940
${PROJECT_SOURCE_DIR}/libversion
@@ -182,12 +173,10 @@ endif()
182173

183174
if(Qt5Core_FOUND)
184175
target_link_libraries(doxywizard Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Xml doxygen_version)
185-
else()
186-
if(Qt6Core_FOUND)
176+
elseif(Qt6Core_FOUND)
187177
target_link_libraries(doxywizard Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Xml doxygen_version)
188178
else()
189179
target_link_libraries(doxywizard ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} doxygen_version)
190180
endif()
191-
endif()
192181

193182
install(TARGETS doxywizard DESTINATION bin)

0 commit comments

Comments
 (0)