2020-10-07 00:11:18 +02:00
|
|
|
# === This file is part of Calamares - <https://calamares.io> ===
|
|
|
|
#
|
|
|
|
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
|
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
#
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# Finds KPMcore and consistently sets API flags based on the version.
|
|
|
|
#
|
2022-07-03 11:39:57 +02:00
|
|
|
# If KPMcore is not found, still create calamares::kpmcore interface
|
|
|
|
# library, which will add definition WITHOUT_KPMcore.
|
|
|
|
#
|
2022-07-21 13:19:19 +02:00
|
|
|
if(NOT TARGET calapmcore)
|
2023-09-07 23:45:57 +02:00
|
|
|
find_package(${kfname}Config CONFIG)
|
|
|
|
find_package(${kfname}I18n CONFIG)
|
|
|
|
find_package(${kfname}WidgetsAddons CONFIG)
|
|
|
|
|
2023-09-04 21:51:03 +02:00
|
|
|
if(NOT WITH_QT6)
|
|
|
|
# TODO: Qt6 how to detect the version of Qt that KPMCore needs?
|
|
|
|
find_package(KPMcore 20.04.0)
|
|
|
|
set_package_properties(
|
|
|
|
KPMcore
|
|
|
|
PROPERTIES
|
|
|
|
URL "https://invent.kde.org/kde/kpmcore"
|
|
|
|
DESCRIPTION "KDE Partitioning library"
|
|
|
|
TYPE RECOMMENDED
|
|
|
|
PURPOSE "For disk partitioning support"
|
|
|
|
)
|
|
|
|
endif()
|
2020-10-07 00:11:18 +02:00
|
|
|
|
2022-07-03 11:39:57 +02:00
|
|
|
# Create an internal Calamares interface to KPMcore
|
|
|
|
# and give it a nice alias name. If kpmcore is not found,
|
|
|
|
# then make a "no KPMcore" library.
|
|
|
|
add_library(calapmcore INTERFACE)
|
|
|
|
|
|
|
|
if(KPMcore_FOUND)
|
2023-09-07 13:03:16 +02:00
|
|
|
find_package(${qtname} REQUIRED DBus) # Needed for KPMCore
|
|
|
|
find_package(${kfname} REQUIRED I18n WidgetsAddons) # Needed for KPMCore
|
2022-07-03 11:39:57 +02:00
|
|
|
|
2023-09-07 13:03:16 +02:00
|
|
|
target_link_libraries(calapmcore INTERFACE kpmcore ${qtname}::DBus ${kfname}::I18n ${kfname}::WidgetsAddons)
|
2022-07-03 11:39:57 +02:00
|
|
|
target_include_directories(calapmcore INTERFACE ${KPMCORE_INCLUDE_DIR})
|
2022-07-21 13:19:19 +02:00
|
|
|
# If there were KPMcore API variations, figure them out here
|
|
|
|
# target_compile_definitions(calapmcore INTERFACE WITH_KPMcore)
|
2022-07-23 23:45:14 +02:00
|
|
|
|
|
|
|
# Flag that this library has KPMcore support. A variable
|
|
|
|
# set here has the wrong scope. ENV{} would be visible
|
|
|
|
# everywhere but seems the wrong thing to do. Setting
|
|
|
|
# properties on calapmcore requires a newer CMake than
|
|
|
|
# Debian 11 has, so runs into support issues.
|
|
|
|
add_library(calamares::kpmcore ALIAS calapmcore)
|
2020-10-07 00:11:18 +02:00
|
|
|
else()
|
2022-07-21 13:19:19 +02:00
|
|
|
target_compile_definitions(calapmcore INTERFACE WITHOUT_KPMcore)
|
2020-10-07 00:11:18 +02:00
|
|
|
endif()
|
2022-07-03 11:39:57 +02:00
|
|
|
else()
|
2022-07-23 23:45:14 +02:00
|
|
|
if(TARGET calamares::kpmcore)
|
2022-07-03 11:39:57 +02:00
|
|
|
message(STATUS "KPMcore has already been found")
|
|
|
|
set(KPMcore_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
message(STATUS "KPMcore has been searched-for and not found")
|
|
|
|
set(KPMcore_FOUND FALSE)
|
|
|
|
endif()
|
2020-10-07 00:11:18 +02:00
|
|
|
endif()
|