CMakeLists.txt 2.51 KB
Newer Older
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
1
2
3
# SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
# SPDX-License-Identifier: BSD-3-Clause

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
4
5
6
cmake_minimum_required(VERSION 3.16)

project(layershellqt)
7
set(PROJECT_VERSION "5.25.1")
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
8
9
set(PROJECT_VERSION_MAJOR 5)

Laurent Montel's avatar
Laurent Montel committed
10
11
set(CMAKE_C_STANDARD 99)

12
set(QT_MIN_VERSION "5.15.2")
13
set(KF5_MIN_VERSION "5.94")
14
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
15
16
17
18
19

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
20
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${ECM_MODULE_PATH})
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
21
22
23
24
25
26
27
28
29
30

include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(CMakePackageConfigHelpers)
include(FeatureSummary)
include(GenerateExportHeader)
include(KDEClangFormat)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
31
include(ECMQtDeclareLoggingCategory)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
32

Volker Krause's avatar
Volker Krause committed
33
34
35
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml)
if (QT_MAJOR_VERSION EQUAL "5")
    find_package(Qt5XkbCommonSupport REQUIRED PRIVATE)
Nicolas Fella's avatar
Nicolas Fella committed
36
    find_package(QtWaylandScanner REQUIRED)
Volker Krause's avatar
Volker Krause committed
37
endif()
Nicolas Fella's avatar
Nicolas Fella committed
38
find_package(WaylandScanner REQUIRED)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
39
find_package(Wayland 1.3 COMPONENTS Client Server)
Nicolas Fella's avatar
Nicolas Fella committed
40
find_package(WaylandProtocols REQUIRED)
Nicolas Fella's avatar
Nicolas Fella committed
41
42
43
find_package(PkgConfig REQUIRED)

pkg_check_modules(XKBCOMMON xkbcommon REQUIRED IMPORTED_TARGET)
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
44
45
46
47
48

set_package_properties(Wayland PROPERTIES
                       TYPE REQUIRED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90")

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
49
ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX LAYERSHELLQT
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
50
51
52
53
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/layershellqt_version.h"
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LayerShellQtConfigVersion.cmake"
                        SOVERSION 5)

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
54
55
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
56
57
58
add_subdirectory(src)
add_subdirectory(tests)

Aleix Pol Gonzalez's avatar
Fixes    
Aleix Pol Gonzalez committed
59
60
61
62
set(CMAKECONFIG_INSTALL_DIR ${KDE_INSTALL_LIBDIR}/cmake/LayerShellQt)
install(EXPORT LayerShellQtTargets
        NAMESPACE LayerShellQt::
        DESTINATION ${CMAKECONFIG_INSTALL_DIR}
Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
63
64
65
66
67
68
69
70
71
        FILE LayerShellQtTargets.cmake)

configure_package_config_file(LayerShellQtConfig.cmake.in
    "${CMAKE_CURRENT_BINARY_DIR}/LayerShellQtConfig.cmake"
    INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LayerShellQtConfig.cmake
              ${CMAKE_CURRENT_BINARY_DIR}/LayerShellQtConfigVersion.cmake
        DESTINATION ${CMAKECONFIG_INSTALL_DIR})
Aleix Pol Gonzalez's avatar
Fixes    
Aleix Pol Gonzalez committed
72

Aleix Pol Gonzalez's avatar
Aleix Pol Gonzalez committed
73
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)