@@ -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/Core 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+ # Host apps depends on "org.commontk.dah.core" which depends on QtSOAP not available with Qt 6
619+ set (CTK_APP_ctkDICOMHost OFF )
620+ set (CTK_APP_ctkExampleHost OFF )
621+ set (CTK_APP_ctkExampleHostedApp OFF )
622+ endif ()
588623
589624if (FALSE )
590625# Since EventBusDemo depends on qxmlrpc that is lacking Qt5 support, it is excluded.
@@ -593,9 +628,14 @@ 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+ # "ctkCommandLineModuleExplorer" depends on "CommandLineModules/Core" which depends on XmlPatterns Qt component not available with Qt 6
637+ set (CTK_APP_ctkCommandLineModuleExplorer OFF )
638+ endif ()
599639
600640# We use the CTKWidgets library together with the Qt Designer plug-in
601641# in ctkCommandLineModuleExplorer, so enabling the options here.
@@ -672,6 +712,7 @@ ctk_plugin_option(org.commontk.plugingenerator.ui
672712 CTK_APP_ctkPluginGenerator)
673713
674714# Plug-ins related to DICOM WG23 (Application Hosting)
715+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
675716ctk_plugin_option(org.commontk.dah.core "Build the org.commontk.dah.core plugin." OFF )
676717ctk_plugin_option(org.commontk.dah.hostedapp "Build the org.commontk.dah.hostedapp plugin." OFF
677718 CTK_ENABLE_DICOMApplicationHosting)
@@ -681,14 +722,31 @@ ctk_plugin_option(org.commontk.dah.host "Build the org.commontk.dah.host plugin.
681722ctk_plugin_option(org.commontk.dah.exampleapp
682723 "Build the org.commontk.dah.exampleapp plugin." OFF
683724 CTK_APP_ctkExampleHostedApp)
725+ else ()
726+ # "org.commontk.dah.core" and its dependent plugins depend on QtSOAP not available with Qt 6
727+ set (CTK_PLUGIN_org.commontk.dah.core OFF )
728+ set (CTK_PLUGIN_org.commontk.dah.hostedapp OFF )
729+ set (CTK_PLUGIN_org.commontk.dah.host OFF )
730+ set (CTK_PLUGIN_org.commontk.dah.exampleapp OFF )
731+ endif ()
684732
733+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
685734ctk_plugin_option(org.commontk.dah.cmdlinemoduleapp
686735 "Build the org.commontk.dah.cmdlinemoduleapp plugin." OFF
687736 CTK_APP_ctkCommandLineModuleApp)
737+ else ()
738+ # "org.commontk.dah.cmdlinemoduleapp" depends on "CommandLineModules/Core" which depends on XmlPatterns Qt component not available with Qt 6
739+ set (CTK_PLUGIN_org.commontk.dah.cmdlinemoduleapp OFF )
740+ endif ()
688741
742+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
689743ctk_plugin_option(org.commontk.dah.examplehost
690744 "Build the org.commontk.dah.examplehost plugin." OFF
691745 CTK_APP_ctkExampleHost)
746+ else ()
747+ # "org.commontk.dah.examplehost" depends on "org.commontk.dah.core" which depends on QtSOAP not available with Qt 6
748+ set (CTK_PLUGIN_org.commontk.dah.examplehost OFF )
749+ endif ()
692750
693751# Plug-ins related to the EventBus demo application
694752if (FALSE )
0 commit comments