From e264415bcc65d4fd1a8a9e7826b3e5632e81df26 Mon Sep 17 00:00:00 2001 From: David Korth Date: Tue, 12 Nov 2024 20:48:17 -0500 Subject: [PATCH] [cmake] Fix Qt6 CMake build system issues on Ubuntu 24.10. - Set QT_NO_CREATE_VERSIONLESS_TARGETS to disable Qt::Core. Otherwise, CMake ends up trying to create Qt::Core twice, even when building for KF6 only and not KF5+KF6: CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt6Core/Qt6CoreVersionlessTargets.cmake:42 (message): Some (but not all) targets in this export set were already defined. Targets Defined: Qt::Core Targets not yet defined: Qt::CorePrivate Call Stack (most recent call first): /usr/lib/x86_64-linux-gnu/cmake/Qt6Core/Qt6CoreConfig.cmake:68 (include) /usr/lib/x86_64-linux-gnu/cmake/Qt6/Qt6Config.cmake:174 (find_package) cmake/libs/RP_FindQt6andKF6.cmake:34 (FIND_PACKAGE) src/kde/kf6/CMakeLists.txt:6 (FIND_QT6_AND_KF6) - Don't specify the minimum KF6 version, because that's breaking for some reason. -- Could NOT find KF65.248.0 (missing: KF65.248.0_DIR) -- Could NOT find KF65.248.0: found neither KF65.248.0Config.cmake nor kf65.248.0-config.cmake CMake Error at /usr/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:233 (message): Could NOT find KF6 (missing: 5.248.0) (found version "6.6.0") Call Stack (most recent call first): /usr/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE) /usr/share/ECM/find-modules/FindKF6.cmake:93 (find_package_handle_standard_args) cmake/libs/RP_FindQt6andKF6.cmake:78 (FIND_PACKAGE) src/kde/kf6/CMakeLists.txt:6 (FIND_QT6_AND_KF6) (cherry picked from commit cb507652cbf5ab3cfce1736283f21ab01d08d553) Conflicts: debian/changelog --- cmake/libs/RP_FindQt4andKDE4.cmake | 1 + cmake/libs/RP_FindQt5andKF5.cmake | 1 + cmake/libs/RP_FindQt6andKF6.cmake | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmake/libs/RP_FindQt4andKDE4.cmake b/cmake/libs/RP_FindQt4andKDE4.cmake index 9ed60f20bc..ab3ef8345a 100644 --- a/cmake/libs/RP_FindQt4andKDE4.cmake +++ b/cmake/libs/RP_FindQt4andKDE4.cmake @@ -2,6 +2,7 @@ MACRO(FIND_QT4_AND_KDE4) SET(ENV{QT_SELECT} qt4) SET(QT_DEFAULT_MAJOR_VERSION 4) + SET(QT_NO_CREATE_VERSIONLESS_TARGETS TRUE) SET(QT4_NO_LINK_QTMAIN 1) FIND_PACKAGE(Qt4 4.6.0 ${REQUIRE_KDE4} COMPONENTS QtCore QtGui QtDBus) diff --git a/cmake/libs/RP_FindQt5andKF5.cmake b/cmake/libs/RP_FindQt5andKF5.cmake index b2f127014f..eab3618713 100644 --- a/cmake/libs/RP_FindQt5andKF5.cmake +++ b/cmake/libs/RP_FindQt5andKF5.cmake @@ -8,6 +8,7 @@ MACRO(FIND_QT5_AND_KF5) SET(ENV{QT_SELECT} qt5) SET(QT_DEFAULT_MAJOR_VERSION 5) + SET(QT_NO_CREATE_VERSIONLESS_TARGETS TRUE) # FIXME: Search for Qt5 first instead of ECM? diff --git a/cmake/libs/RP_FindQt6andKF6.cmake b/cmake/libs/RP_FindQt6andKF6.cmake index ca500840cb..1dff716334 100644 --- a/cmake/libs/RP_FindQt6andKF6.cmake +++ b/cmake/libs/RP_FindQt6andKF6.cmake @@ -7,6 +7,7 @@ MACRO(FIND_QT6_AND_KF6) SET(ENV{QT_SELECT} qt6) SET(QT_DEFAULT_MAJOR_VERSION 6) + SET(QT_NO_CREATE_VERSIONLESS_TARGETS TRUE) # FIXME: Search for Qt6 first instead of ECM? SET(KF6_MIN 5.248.0) @@ -73,7 +74,9 @@ MACRO(FIND_QT6_AND_KF6) SET(QT_PLUGIN_INSTALL_DIR "${KF6_PLUGIN_INSTALL_DIR}") # Find KF6. - FIND_PACKAGE(KF6 ${REQUIRE_KF6} ${KF6_MIN} COMPONENTS KIO WidgetsAddons FileMetaData Crash) + # FIXME: Specifying the minimum version here breaks on Kubuntu 24.10. + #FIND_PACKAGE(KF6 ${REQUIRE_KF6} ${KF6_MIN} COMPONENTS KIO WidgetsAddons FileMetaData Crash) + FIND_PACKAGE(KF6 ${REQUIRE_KF6} COMPONENTS KIO WidgetsAddons FileMetaData Crash) IF(NOT KF6KIO_FOUND OR NOT KF6WidgetsAddons_FOUND OR NOT KF6FileMetaData_FOUND OR NOT KF6Crash_FOUND) # KF6 not found. SET(BUILD_KF6 OFF CACHE INTERNAL "Build the KDE Frameworks 6 plugin." FORCE)