From b76c386d34994316f801578a6de108f21df0ee20 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 25 Oct 2023 15:01:45 -0400 Subject: [PATCH] COMP: Fix configuration without explicitly setting CTK_QT_VERSION Address a regression introduced in a0e74a080 (COMP: Update CMake files removing support for Qt 4.x) by fixing the following error reported when configuring without explicitly setting CTK_QT_VERSION: ``` cmake \ -DQt5_DIR:PATH=$Qt5_DIR \ -DCMAKE_BUILD_TYPE:STRING=Release \ ../CTK [...] -- Checking if --no-as-needed linker flag is required - no -- CTK_LIB_Core_WITH_BFD_SHARED is OFF -- CTK_LIB_Core_WITH_BFD_STATIC is OFF CMake Error at Libs/Visualization/VTK/Widgets/target_libraries.cmake:15 (message): Support for this Qt is not implemented Call Stack (most recent call first): CMake/ctkMacroTargetLibraries.cmake:131 (include) CMake/ctkFunctionGenerateDGraphInput.cmake:78 (ctkFunctionCollectTargetLibraryNames) CMakeLists.txt:844 (ctkFunctionGenerateDGraphInput) [...] ``` --- CMake/ctkMacroSetupQt.cmake | 10 ---------- CMakeLists.txt | 8 ++++++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CMake/ctkMacroSetupQt.cmake b/CMake/ctkMacroSetupQt.cmake index 38e4c2f894..cfd93cf345 100644 --- a/CMake/ctkMacroSetupQt.cmake +++ b/CMake/ctkMacroSetupQt.cmake @@ -20,14 +20,6 @@ #! \ingroup CMakeUtilities macro(ctkMacroSetupQt) - set(CTK_QT_VERSION "5" CACHE STRING "Expected Qt version") - mark_as_advanced(CTK_QT_VERSION) - - set_property(CACHE CTK_QT_VERSION PROPERTY STRINGS 5) - - if(NOT CTK_QT_VERSION VERSION_EQUAL "5") - message(FATAL_ERROR "Expected value for CTK_QT_VERSION is '5'") - endif() if(CTK_QT_VERSION VERSION_EQUAL "5") cmake_minimum_required(VERSION 2.8.12) @@ -139,6 +131,4 @@ macro(ctkMacroSetupQt) else() message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() - - mark_as_superbuild(CTK_QT_VERSION) endmacro() diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ba2e9c52b..8256a4e873 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,14 @@ mark_as_superbuild( option(CTK_SUPERBUILD "Build ${PROJECT_NAME} and the projects it depends on." ON) mark_as_advanced(CTK_SUPERBUILD) +#----------------------------------------------------------------------------- +# Qt version +# +set(CTK_QT_VERSION "5" CACHE STRING "Expected Qt version") +mark_as_advanced(CTK_QT_VERSION) +set_property(CACHE CTK_QT_VERSION PROPERTY STRINGS 5) +mark_as_superbuild(CTK_QT_VERSION) + #----------------------------------------------------------------------------- # Output directories. #