6a31e30cbf
Be a little more chatty and look for the correct KDE Frameworks for consumers of Calamares (e.g. calamares-extensions).
105 lines
3.5 KiB
CMake
105 lines
3.5 KiB
CMake
# SPDX-FileCopyrightText: 2014 Teo Mrnjavac <teo@kde.org>
|
|
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
#
|
|
# Note that Calamares itself is GPL-3.0-or-later: the above license
|
|
# applies to **this** CMake file.
|
|
#
|
|
# Config file for the Calamares package
|
|
#
|
|
# The following IMPORTED targets are defined:
|
|
# - Calamares::calamares - the core library
|
|
# - Calamares::calamaresui - the UI (and QML) library
|
|
#
|
|
# For legacy use it defines the following variables:
|
|
# - Calamares_INCLUDE_DIRS - include directories for Calamares
|
|
# - Calamares_LIB_DIRS - library directories
|
|
# - Calamares_LIBRARIES - libraries to link against
|
|
|
|
@PACKAGE_INIT@
|
|
|
|
### Versioning and IMPORTED targets
|
|
#
|
|
#
|
|
include(${CMAKE_CURRENT_LIST_DIR}/CalamaresConfigVersion.cmake)
|
|
include(${CMAKE_CURRENT_LIST_DIR}/CalamaresTargets.cmake)
|
|
if (NOT TARGET Calamares::calamares OR NOT TARGET Calamares::calamaresui)
|
|
message(FATAL_ERROR "Calamares found with missing CMake targets")
|
|
endif()
|
|
|
|
# Need various CMake files that are installed alongside this one.
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
|
|
|
### Dependencies
|
|
#
|
|
# The libraries can depend on a variety of Qt and KDE Frameworks
|
|
# components, so accumulate them and find (just once).
|
|
#
|
|
macro(accumulate_deps outvar target namespace)
|
|
string(LENGTH ${namespace} _nslen)
|
|
get_target_property(_libs ${target} INTERFACE_LINK_LIBRARIES)
|
|
foreach(_lib ${_libs})
|
|
if (_lib MATCHES ^${namespace})
|
|
string(SUBSTRING ${_lib} ${_nslen} -1 _component)
|
|
list(APPEND ${outvar} ${_component})
|
|
endif()
|
|
endforeach()
|
|
endmacro()
|
|
|
|
set(Calamares_WITH_QT6 @WITH_QT6@)
|
|
if(Calamares_WITH_QT6)
|
|
set(qtname "Qt6")
|
|
set(kfname "kf6")
|
|
message(STATUS "Calamares was built with Qt6 and KDE Frameworks 6")
|
|
else()
|
|
set(qtname "Qt5")
|
|
set(kfname "kf5")
|
|
message(STATUS "Calamares was built with Qt5 and KDE Frameworks 5 (legacy)")
|
|
endif()
|
|
|
|
# Qt infrastructure for translations is required
|
|
set(qt_required Core Widgets LinguistTools)
|
|
accumulate_deps(qt_required Calamares::calamares ${qtname}::)
|
|
accumulate_deps(qt_required Calamares::calamaresui ${qtname}::)
|
|
find_package(${qtname} CONFIG REQUIRED ${qt_required})
|
|
|
|
set(kf_required "")
|
|
accumulate_deps(kf_required Calamares::calamares ${kfname}::)
|
|
accumulate_deps(kf_required Calamares::calamaresui ${kfname}::)
|
|
if(kf_required)
|
|
find_package(ECM ${ECM_VERSION} NO_MODULE)
|
|
if( ECM_FOUND )
|
|
list(INSERT CMAKE_MODULE_PATH 0 ${ECM_MODULE_PATH})
|
|
find_package(${kfname} REQUIRED COMPONENTS ${kf_required})
|
|
endif()
|
|
endif()
|
|
|
|
find_package(YAMLCPP REQUIRED)
|
|
|
|
### Legacy support
|
|
#
|
|
#
|
|
set(Calamares_LIB_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
|
|
set(Calamares_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
|
|
set(Calamares_LIBRARIES Calamares::calamares)
|
|
|
|
### CMake support
|
|
#
|
|
#
|
|
include(CalamaresAddBrandingSubdirectory)
|
|
include(CalamaresAddLibrary)
|
|
include(CalamaresAddModuleSubdirectory)
|
|
include(CalamaresAddPlugin)
|
|
|
|
# These are feature-settings that affect consumers of Calamares
|
|
# libraries as well; without Python-support in the libs, for instance,
|
|
# there's no point in having a Python plugin.
|
|
#
|
|
# This list should match the one in libcalamares/CalamaresConfig.h,
|
|
# which is the C++-language side of the same configuration.
|
|
set(Calamares_WITH_PYTHON @WITH_PYTHON@)
|
|
set(Calamares_WITH_PYBIND11 @WITH_PYBIND11@)
|
|
set(Calamares_WITH_BOOST_PYTHON @WITH_BOOST_PYTHON@)
|
|
set(Calamares_WITH_QML @WITH_QML@)
|
|
set(Calamares_WITH_QT6 @WITH_QT6@)
|