OSDN Git Service

[libcalamares] Log the Python language-search process just once
[alterlinux/alterlinux-calamares.git] / CalamaresConfig.cmake.in
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
4 #
5 # Note that Calamares itself is GPL-3.0-or-later: the above license
6 # applies to **this** CMake file.
7 #
8 # Config file for the Calamares package
9 #
10 # The following IMPORTED targets are defined:
11 #   - Calamares::calamares      - the core library
12 #   - Calamares::calamaresui    - the UI (and QML) library
13 #
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
18
19 @PACKAGE_INIT@
20
21 ### Versioning and IMPORTED targets
22 #
23 #
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")
28 endif()
29
30 # Need various CMake files that are installed alongside this one.
31 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
32
33 ### Dependencies
34 #
35 # The libraries can depend on a variety of Qt and KDE Frameworks
36 # components, so accumulate them and find (just once).
37 #
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})
45         endif()
46     endforeach()
47 endmacro()
48
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})
54
55 set(kf5_required "")
56 accumulate_deps(kf5_required Calamares::calamares KF5::)
57 accumulate_deps(kf5_required Calamares::calamaresui KF5::)
58 if(kf5_required)
59     find_package(ECM ${ECM_VERSION} NO_MODULE)
60     if( ECM_FOUND )
61         list(INSERT CMAKE_MODULE_PATH 0 ${ECM_MODULE_PATH})
62         find_package(KF5 REQUIRED COMPONENTS ${kf5_required})
63     endif()
64 endif()
65
66 find_package(YAMLCPP REQUIRED)
67
68 ### Legacy support
69 #
70 #
71 set(Calamares_LIB_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
72 set(Calamares_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
73 set(Calamares_LIBRARIES Calamares::calamares)
74
75 ### CMake support
76 #
77 #
78 include(CalamaresAddBrandingSubdirectory)
79 include(CalamaresAddLibrary)
80 include(CalamaresAddModuleSubdirectory)
81 include(CalamaresAddPlugin)
82
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.
86 #
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@)