@@ -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,10 @@ 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+ endif ()
545+
524546ctk_lib_option(XNAT/Core
525547 "Build the XNAT Core library" OFF )
526548
@@ -574,6 +596,7 @@ ctk_app_option(ctkDICOMQueryRetrieve
574596 "Build the DICOM example application" OFF
575597 CTK_ENABLE_DICOM AND CTK_BUILD_EXAMPLES)
576598
599+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
577600ctk_app_option(ctkDICOMHost
578601 "Build the DICOM application host example application" OFF
579602 CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES)
@@ -585,6 +608,9 @@ ctk_app_option(ctkExampleHost
585608ctk_app_option(ctkExampleHostedApp
586609 "Build the DICOM example application" OFF
587610 CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES)
611+ else ()
612+ # "org.commontk.dah.core" depends on QtSOAP not available with Qt 6
613+ endif ()
588614
589615if (FALSE )
590616# Since EventBusDemo depends on qxmlrpc that is lacking Qt5 support, it is excluded.
@@ -593,9 +619,15 @@ ctk_app_option(ctkEventBusDemo
593619 CTK_ENABLE_PluginFramework AND CTK_BUILD_EXAMPLES)
594620endif ()
595621
622+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
596623ctk_app_option(ctkCommandLineModuleExplorer
597624 "Build the Command Line Module Explorer" OFF
598625 CTK_BUILD_EXAMPLES)
626+ else ()
627+ # Forcing to OFF as XmlPatterns Qt component is not available with Qt 6
628+ unset (CTK_APP_ctkCommandLineModuleExplorer CACHE )
629+ set (CTK_APP_ctkCommandLineModuleExplorer OFF )
630+ endif ()
599631
600632# We use the CTKWidgets library together with the Qt Designer plug-in
601633# in ctkCommandLineModuleExplorer, so enabling the options here.
@@ -672,6 +704,7 @@ ctk_plugin_option(org.commontk.plugingenerator.ui
672704 CTK_APP_ctkPluginGenerator)
673705
674706# Plug-ins related to DICOM WG23 (Application Hosting)
707+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
675708ctk_plugin_option(org.commontk.dah.core "Build the org.commontk.dah.core plugin." OFF )
676709ctk_plugin_option(org.commontk.dah.hostedapp "Build the org.commontk.dah.hostedapp plugin." OFF
677710 CTK_ENABLE_DICOMApplicationHosting)
@@ -681,14 +714,25 @@ ctk_plugin_option(org.commontk.dah.host "Build the org.commontk.dah.host plugin.
681714ctk_plugin_option(org.commontk.dah.exampleapp
682715 "Build the org.commontk.dah.exampleapp plugin." OFF
683716 CTK_APP_ctkExampleHostedApp)
717+ else ()
718+ # "org.commontk.dah.core" depends on QtSOAP not available with Qt 6
719+ endif ()
684720
721+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
685722ctk_plugin_option(org.commontk.dah.cmdlinemoduleapp
686723 "Build the org.commontk.dah.cmdlinemoduleapp plugin." OFF
687724 CTK_APP_ctkCommandLineModuleApp)
725+ else ()
726+ # "CommandLineModules/Core" depends on XmlPatterns Qt component not available with Qt 6
727+ endif ()
688728
729+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
689730ctk_plugin_option(org.commontk.dah.examplehost
690731 "Build the org.commontk.dah.examplehost plugin." OFF
691732 CTK_APP_ctkExampleHost)
733+ else ()
734+ # "org.commontk.dah.core" depends on QtSOAP not available with Qt 6
735+ endif ()
692736
693737# Plug-ins related to the EventBus demo application
694738if (FALSE )
0 commit comments