Skip to content

Commit

Permalink
Add WITH_QT6 option
Browse files Browse the repository at this point in the history
- On systems with both qt5 and qt6 installed, cmake will use qt6 by default.
  • Loading branch information
nunotexbsd authored and juzzlin committed Sep 22, 2022
1 parent 47c4c3b commit 3628823
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Expand Up @@ -96,9 +96,14 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(QT_MIN_VER 5.9.5) # The version in Ubuntu 18.04 LTS
# This is what Qt Creator 4.13.2 would generate
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Xml Widgets LinguistTools Svg Test Network REQUIRED)

OPTION(WITH_QT6 "Enable Qt 6" OFF)
if (WITH_QT6)
find_package(QT NAMES Qt6 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Xml Widgets LinguistTools Svg Test Network REQUIRED)
else()
find_package(QT NAMES Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Xml Widgets LinguistTools Svg Test Network REQUIRED)
endif()
# Install paths depend on the build type and target platform
setup_install_targets()

Expand Down

0 comments on commit 3628823

Please sign in to comment.