@@ -105,10 +105,18 @@ mark_as_advanced(CTK_SUPERBUILD)
105105#-----------------------------------------------------------------------------
106106# Qt version
107107#
108- set (CTK_QT_VERSION "5" CACHE STRING "Expected Qt version" )
108+ if (DEFINED Qt6_DIR)
109+ set (_default_qt_major_version "6" )
110+ else ()
111+ set (_default_qt_major_version "5" )
112+ endif ()
113+ set (CTK_QT_VERSION "${_default_qt_major_version} " CACHE STRING "Expected major Qt version" )
109114mark_as_advanced (CTK_QT_VERSION )
110- set_property (CACHE CTK_QT_VERSION PROPERTY STRINGS 5 )
115+ set_property (CACHE CTK_QT_VERSION PROPERTY STRINGS 5 6 )
111116mark_as_superbuild (CTK_QT_VERSION )
117+ if (NOT "${CTK_QT_VERSION} " MATCHES "^(5|6)$" )
118+ message (FATAL_ERROR "error: CTK_QT_VERSION must be 5 or 6." )
119+ endif ()
112120
113121#-----------------------------------------------------------------------------
114122# Output directories.
@@ -319,8 +327,17 @@ endif()
319327#-----------------------------------------------------------------------------
320328# QtTesting
321329#
330+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
322331option (CTK_USE_QTTESTING "Enable/Disable QtTesting" OFF )
323332mark_as_advanced (CTK_USE_QTTESTING )
333+ else ()
334+ # Forcing to OFF as "QtTesting" depends on XmlPatterns Qt component not available with Qt 6
335+ if (DEFINED CTK_USE_QTTESTING AND CTK_USE_QTTESTING)
336+ unset (CTK_USE_QTTESTING CACHE )
337+ set (CTK_USE_QTTESTING OFF )
338+ message (WARNING "Forcing option [CTK_USE_QTTESTING] to OFF as QtTesting depends on XmlPatterns Qt component not available with Qt ${CTK_QT_VERSION} " )
339+ endif ()
340+ endif ()
324341mark_as_superbuild (CTK_USE_QTTESTING )
325342
326343#-----------------------------------------------------------------------------
@@ -503,6 +520,7 @@ ctk_lib_option(Visualization/VTK/Core
503520ctk_lib_option (Visualization/VTK/Widgets
504521 "Build the VTK Widgets library" OFF )
505522
523+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
506524ctk_lib_option (CommandLineModules/Core
507525 "Build the Command Line Module core library" OFF )
508526
@@ -521,6 +539,16 @@ ctk_lib_option(CommandLineModules/Backend/LocalProcess
521539ctk_lib_option (CommandLineModules/Backend/FunctionPointer
522540 "Build the Command Line Module back-end for function pointers" OFF )
523541
542+ else ()
543+ # "CommandLineModules/Core" depends on XmlPatterns Qt component not available with Qt 6
544+ set (CTK_LIB_CommandLineModules OFF )
545+ set (CTK_LIB_CommandLineModules/Frontend/QtWebKit OFF )
546+ set (CTK_LIB_CommandLineModules/Frontend/QtGui OFF )
547+ set (CTK_LIB_CommandLineModules/Backend/XMLChecker OFF )
548+ set (CTK_LIB_CommandLineModules/Backend/LocalProcess OFF )
549+ set (CTK_LIB_CommandLineModules/Backend/FunctionPointer OFF )
550+ endif ()
551+
524552ctk_lib_option (XNAT/Core
525553 "Build the XNAT Core library" OFF )
526554
@@ -574,6 +602,7 @@ ctk_app_option(ctkDICOMQueryRetrieve
574602 "Build the DICOM example application" OFF
575603 CTK_ENABLE_DICOM AND CTK_BUILD_EXAMPLES )
576604
605+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
577606ctk_app_option (ctkDICOMHost
578607 "Build the DICOM application host example application" OFF
579608 CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES )
@@ -585,6 +614,12 @@ ctk_app_option(ctkExampleHost
585614ctk_app_option (ctkExampleHostedApp
586615 "Build the DICOM example application" OFF
587616 CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES )
617+ else ()
618+ # "org.commontk.dah.core" depends on QtSOAP not available with Qt 6
619+ set (CTK_APP_ctkDICOMHost OFF )
620+ set (CTK_APP_ctkExampleHostedApp OFF )
621+ set (CTK_APP_ctkExampleHost OFF )
622+ endif ()
588623
589624if (FALSE )
590625# Since EventBusDemo depends on qxmlrpc that is lacking Qt5 support, it is excluded.
@@ -593,9 +628,15 @@ ctk_app_option(ctkEventBusDemo
593628 CTK_ENABLE_PluginFramework AND CTK_BUILD_EXAMPLES )
594629endif ()
595630
631+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
596632ctk_app_option (ctkCommandLineModuleExplorer
597633 "Build the Command Line Module Explorer" OFF
598634 CTK_BUILD_EXAMPLES )
635+ else ()
636+ # Forcing to OFF as XmlPatterns Qt component is not available with Qt 6
637+ unset (CTK_APP_ctkCommandLineModuleExplorer CACHE )
638+ set (CTK_APP_ctkCommandLineModuleExplorer OFF )
639+ endif ()
599640
600641# We use the CTKWidgets library together with the Qt Designer plug-in
601642# in ctkCommandLineModuleExplorer, so enabling the options here.
@@ -672,6 +713,7 @@ ctk_plugin_option(org.commontk.plugingenerator.ui
672713 CTK_APP_ctkPluginGenerator )
673714
674715# Plug-ins related to DICOM WG23 (Application Hosting)
716+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
675717ctk_plugin_option (org.commontk.dah.core "Build the org.commontk.dah.core plugin." OFF )
676718ctk_plugin_option (org.commontk.dah.hostedapp "Build the org.commontk.dah.hostedapp plugin." OFF
677719 CTK_ENABLE_DICOMApplicationHosting )
@@ -681,14 +723,27 @@ ctk_plugin_option(org.commontk.dah.host "Build the org.commontk.dah.host plugin.
681723ctk_plugin_option (org.commontk.dah.exampleapp
682724 "Build the org.commontk.dah.exampleapp plugin." OFF
683725 CTK_APP_ctkExampleHostedApp )
726+ else ()
727+ # "org.commontk.dah.core" depends on QtSOAP not available with Qt 6
728+ set (CTK_PLUGIN_org.commontk.dah.core OFF )
729+ endif ()
684730
731+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
685732ctk_plugin_option (org.commontk.dah.cmdlinemoduleapp
686733 "Build the org.commontk.dah.cmdlinemoduleapp plugin." OFF
687734 CTK_APP_ctkCommandLineModuleApp )
735+ else ()
736+ # "CommandLineModules/Core" depends on XmlPatterns Qt component not available with Qt 6
737+ set (CTK_PLUGIN_org.commontk.dah.cmdlinemoduleapp OFF )
738+ endif ()
688739
740+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
689741ctk_plugin_option (org.commontk.dah.examplehost
690742 "Build the org.commontk.dah.examplehost plugin." OFF
691743 CTK_APP_ctkExampleHost )
744+ else ()
745+ # "org.commontk.dah.core" depends on QtSOAP not available with Qt 6
746+ endif ()
692747
693748# Plug-ins related to the EventBus demo application
694749if (FALSE )
0 commit comments