[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 cb507652cb)

Conflicts:
	debian/changelog
This commit is contained in:
David Korth 2024-11-12 20:48:17 -05:00
parent 530c02f1cb
commit e264415bcc
3 changed files with 6 additions and 1 deletions

View File

@ -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)

View File

@ -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?

View File

@ -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)