1 # SPDX-FileCopyrightText: 2014 Teo Mrnjavac <teo@kde.org>
2 # SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
3 # SPDX-License-Identifier: BSD-2-Clause
5 # Note that Calamares itself is GPL-3.0-or-later: the above license
6 # applies to **this** CMake file.
8 # Config file for the Calamares package
10 # The following IMPORTED targets are defined:
11 # - Calamares::calamares - the core library
12 # - Calamares::calamaresui - the UI (and QML) library
14 # For legacy use it defines the following variables:
15 # - Calamares_INCLUDE_DIRS - include directories for Calamares
16 # - Calamares_LIB_DIRS - library directories
17 # - Calamares_LIBRARIES - libraries to link against
21 ### Versioning and IMPORTED targets
24 include(${CMAKE_CURRENT_LIST_DIR}/CalamaresConfigVersion.cmake)
25 include(${CMAKE_CURRENT_LIST_DIR}/CalamaresTargets.cmake)
26 if (NOT TARGET Calamares::calamares OR NOT TARGET Calamares::calamaresui)
27 message(FATAL_ERROR "Calamares found with missing CMake targets")
30 # Need various CMake files that are installed alongside this one.
31 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
35 # The libraries can depend on a variety of Qt and KDE Frameworks
36 # components, so accumulate them and find (just once).
38 macro(accumulate_deps outvar target namespace)
39 string(LENGTH ${namespace} _nslen)
40 get_target_property(_libs ${target} INTERFACE_LINK_LIBRARIES)
41 foreach(_lib ${_libs})
42 if (_lib MATCHES ^${namespace})
43 string(SUBSTRING ${_lib} ${_nslen} -1 _component)
44 list(APPEND ${outvar} ${_component})
49 # Qt5 infrastructure for translations is required
50 set(qt5_required Core Widgets LinguistTools)
51 accumulate_deps(qt5_required Calamares::calamares Qt5::)
52 accumulate_deps(qt5_required Calamares::calamaresui Qt5::)
53 find_package(Qt5 CONFIG REQUIRED ${qt5_required})
56 accumulate_deps(kf5_required Calamares::calamares KF5::)
57 accumulate_deps(kf5_required Calamares::calamaresui KF5::)
59 find_package(ECM ${ECM_VERSION} NO_MODULE)
61 list(INSERT CMAKE_MODULE_PATH 0 ${ECM_MODULE_PATH})
62 find_package(KF5 REQUIRED COMPONENTS ${kf5_required})
66 find_package(YAMLCPP REQUIRED)
71 set(Calamares_LIB_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
72 set(Calamares_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
73 set(Calamares_LIBRARIES Calamares::calamares)
78 include(CalamaresAddBrandingSubdirectory)
79 include(CalamaresAddLibrary)
80 include(CalamaresAddModuleSubdirectory)
81 include(CalamaresAddPlugin)
83 # These are feature-settings that affect consumers of Calamares
84 # libraries as well; without Python-support in the libs, for instance,
85 # there's no point in having a Python plugin.
87 # This list should match the one in libcalamares/CalamaresConfig.h,
88 # which is the C++-language side of the same configuration.
89 set(Calamares_WITH_PYTHON @WITH_PYTHON@)
90 set(Calamares_WITH_PYTHONQT @WITH_PYTHONQT@)
91 set(Calamares_WITH_QML @WITH_QML@)