@@ -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 "CTK_QT_VERSION must be 5 or 6." )
119+ endif ()
112120
113121#-----------------------------------------------------------------------------
114122# Output directories.
@@ -321,6 +329,14 @@ endif()
321329#
322330option (CTK_USE_QTTESTING "Enable/Disable QtTesting" OFF )
323331mark_as_advanced (CTK_USE_QTTESTING)
332+ if (NOT CTK_QT_VERSION VERSION_EQUAL "5" )
333+ # Forcing to OFF as "QtTesting" depends on XmlPatterns Qt component not available with Qt 6
334+ if (DEFINED CTK_USE_QTTESTING AND CTK_USE_QTTESTING)
335+ unset (CTK_USE_QTTESTING CACHE )
336+ set (CTK_USE_QTTESTING OFF )
337+ message (WARNING "Forcing option [CTK_USE_QTTESTING] to OFF as QtTesting depends on XmlPatterns Qt component not available with Qt ${CTK_QT_VERSION} " )
338+ endif ()
339+ endif ()
324340mark_as_superbuild(CTK_USE_QTTESTING)
325341
326342#-----------------------------------------------------------------------------
@@ -503,6 +519,7 @@ ctk_lib_option(Visualization/VTK/Core
503519ctk_lib_option(Visualization/VTK/Widgets
504520 "Build the VTK Widgets library" OFF )
505521
522+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
506523ctk_lib_option(CommandLineModules/Core
507524 "Build the Command Line Module core library" OFF )
508525
@@ -521,6 +538,16 @@ ctk_lib_option(CommandLineModules/Backend/LocalProcess
521538ctk_lib_option(CommandLineModules/Backend/FunctionPointer
522539 "Build the Command Line Module back-end for function pointers" OFF )
523540
541+ else ()
542+ # "CommandLineModules/Core" depends on XmlPatterns Qt component not available with Qt 6
543+ set (CTK_LIB_CommandLineModules/Core OFF )
544+ set (CTK_LIB_CommandLineModules/Frontend/QtWebKit OFF )
545+ set (CTK_LIB_CommandLineModules/Frontend/QtGui OFF )
546+ set (CTK_LIB_CommandLineModules/Backend/XMLChecker OFF )
547+ set (CTK_LIB_CommandLineModules/Backend/LocalProcess OFF )
548+ set (CTK_LIB_CommandLineModules/Backend/FunctionPointer OFF )
549+ endif ()
550+
524551ctk_lib_option(XNAT/Core
525552 "Build the XNAT Core library" OFF )
526553
@@ -574,6 +601,7 @@ ctk_app_option(ctkDICOMQueryRetrieve
574601 "Build the DICOM example application" OFF
575602 CTK_ENABLE_DICOM AND CTK_BUILD_EXAMPLES)
576603
604+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
577605ctk_app_option(ctkDICOMHost
578606 "Build the DICOM application host example application" OFF
579607 CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES)
@@ -585,6 +613,12 @@ ctk_app_option(ctkExampleHost
585613ctk_app_option(ctkExampleHostedApp
586614 "Build the DICOM example application" OFF
587615 CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES)
616+ else ()
617+ # Host apps depends on "org.commontk.dah.core" which depends on QtSOAP not available with Qt 6
618+ set (CTK_APP_ctkDICOMHost OFF )
619+ set (CTK_APP_ctkExampleHost OFF )
620+ set (CTK_APP_ctkExampleHostedApp OFF )
621+ endif ()
588622
589623if (FALSE )
590624# Since EventBusDemo depends on qxmlrpc that is lacking Qt5 support, it is excluded.
@@ -593,9 +627,14 @@ ctk_app_option(ctkEventBusDemo
593627 CTK_ENABLE_PluginFramework AND CTK_BUILD_EXAMPLES)
594628endif ()
595629
630+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
596631ctk_app_option(ctkCommandLineModuleExplorer
597632 "Build the Command Line Module Explorer" OFF
598633 CTK_BUILD_EXAMPLES)
634+ else ()
635+ # "ctkCommandLineModuleExplorer" depends on "CommandLineModules/Core" which depends on XmlPatterns Qt component not available with Qt 6
636+ set (CTK_APP_ctkCommandLineModuleExplorer OFF )
637+ endif ()
599638
600639# We use the CTKWidgets library together with the Qt Designer plug-in
601640# in ctkCommandLineModuleExplorer, so enabling the options here.
@@ -672,6 +711,7 @@ ctk_plugin_option(org.commontk.plugingenerator.ui
672711 CTK_APP_ctkPluginGenerator)
673712
674713# Plug-ins related to DICOM WG23 (Application Hosting)
714+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
675715ctk_plugin_option(org.commontk.dah.core "Build the org.commontk.dah.core plugin." OFF )
676716ctk_plugin_option(org.commontk.dah.hostedapp "Build the org.commontk.dah.hostedapp plugin." OFF
677717 CTK_ENABLE_DICOMApplicationHosting)
@@ -681,14 +721,31 @@ ctk_plugin_option(org.commontk.dah.host "Build the org.commontk.dah.host plugin.
681721ctk_plugin_option(org.commontk.dah.exampleapp
682722 "Build the org.commontk.dah.exampleapp plugin." OFF
683723 CTK_APP_ctkExampleHostedApp)
724+ else ()
725+ # "org.commontk.dah.core" and its dependent plugins depend on QtSOAP not available with Qt 6
726+ set (CTK_PLUGIN_org.commontk.dah.core OFF )
727+ set (CTK_PLUGIN_org.commontk.dah.hostedapp OFF )
728+ set (CTK_PLUGIN_org.commontk.dah.host OFF )
729+ set (CTK_PLUGIN_org.commontk.dah.exampleapp OFF )
730+ endif ()
684731
732+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
685733ctk_plugin_option(org.commontk.dah.cmdlinemoduleapp
686734 "Build the org.commontk.dah.cmdlinemoduleapp plugin." OFF
687735 CTK_APP_ctkCommandLineModuleApp)
736+ else ()
737+ # "org.commontk.dah.cmdlinemoduleapp" depends on "CommandLineModules/Core" which depends on XmlPatterns Qt component not available with Qt 6
738+ set (CTK_PLUGIN_org.commontk.dah.cmdlinemoduleapp OFF )
739+ endif ()
688740
741+ if (CTK_QT_VERSION VERSION_EQUAL "5" )
689742ctk_plugin_option(org.commontk.dah.examplehost
690743 "Build the org.commontk.dah.examplehost plugin." OFF
691744 CTK_APP_ctkExampleHost)
745+ else ()
746+ # "org.commontk.dah.examplehost" depends on "org.commontk.dah.core" which depends on QtSOAP not available with Qt 6
747+ set (CTK_PLUGIN_org.commontk.dah.examplehost OFF )
748+ endif ()
692749
693750# Plug-ins related to the EventBus demo application
694751if (FALSE )
0 commit comments