@@ -85,6 +85,7 @@ if(WIN32)
85
85
option (PORTABLE_WIN "Compile app for portability" OFF )
86
86
endif (WIN32 )
87
87
88
+ option (USE_QT6_BY_DEFAULT "Use Qt6 if available (if not available fallback to QT5)" OFF )
88
89
option (UPDATE_TRANSLATIONS "Call lupdate to update translation files from source." OFF )
89
90
option (TRANS_REMOVE_OBSOLETE "Add -noobsolete option to lupdate command to get rid of old text entries" OFF )
90
91
option (ATTACH_FAKE_CLASSES "Fake classes can be used in application to tests functionalities" OFF )
@@ -523,15 +524,37 @@ endif(UNIX)
523
524
set (QT_REQUIRED_VERSION 5.8)
524
525
set (CMAKE_AUTOMOC TRUE ) # required by moc preprocessor used in QT
525
526
526
- find_package (QT NAMES Qt5 REQUIRED) # used to get version number in QT_VERSION_MAJOR and QT_VERSION
527
- message ("Found QT: ${QT_VERSION} " )
527
+ if (USE_QT6_BY_DEFAULT)
528
+ find_package (Qt6 COMPONENTS Core)
529
+ if (NOT Qt6_FOUND)
530
+ message ("QT6 not found. Falling back to QT5." )
531
+ endif ()
532
+ else ()
533
+ find_package (Qt5 COMPONENTS Core)
534
+ if (NOT Qt5_FOUND)
535
+ message ("QT5 not found. Falling back to QT6." )
536
+ endif ()
537
+ endif ()
538
+
539
+ if (Qt6_FOUND OR NOT Qt5_FOUND)
540
+ find_package (Qt6 ${QT_REQUIRED_VERSION}
541
+ COMPONENTS Core Widgets Gui Network LinguistTools Concurrent
542
+ REQUIRED)
543
+ find_package (QT NAMES Qt6 REQUIRED) # used to get version number in QT_VERSION_MAJOR and QT_VERSION
528
544
529
- find_package (Qt5 ${QT_REQUIRED_VERSION}
545
+ QT_WRAP_UI (antimicrox_FORMS_HEADERS ${antimicrox_FORMS} )
546
+ QT_ADD_RESOURCES(antimicrox_RESOURCES_RCC ${antimicrox_RESOURCES} )
547
+ else ()
548
+ find_package (Qt5 ${QT_REQUIRED_VERSION}
530
549
COMPONENTS Core Widgets Gui Network LinguistTools Concurrent
531
550
REQUIRED)
551
+ find_package (QT NAMES Qt5 REQUIRED) # used to get version number in QT_VERSION_MAJOR and QT_VERSION
552
+
553
+ QT5_WRAP_UI(antimicrox_FORMS_HEADERS ${antimicrox_FORMS} )
554
+ QT5_ADD_RESOURCES(antimicrox_RESOURCES_RCC ${antimicrox_RESOURCES} )
555
+ endif ()
556
+ message ("Found QT: ${QT_VERSION} " )
532
557
533
- QT5_WRAP_UI(antimicrox_FORMS_HEADERS ${antimicrox_FORMS} )
534
- QT5_ADD_RESOURCES(antimicrox_RESOURCES_RCC ${antimicrox_RESOURCES} )
535
558
add_subdirectory ("share/antimicrox/translations" )
536
559
set (CMAKE_POSITION_INDEPENDENT_CODE ON )
537
560
0 commit comments