CMakeLists.txt 2.88 KB
Newer Older
1
2
cmake_minimum_required(VERSION 3.0)

3
project(decoration-api)
4
set(PROJECT_VERSION "5.17.80")
5

6
set(QT_MIN_VERSION "5.12.0")
7
set(KF5_MIN_VERSION "5.66.0")
8

9
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
10
11
12
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})

13
14
15
16
17
include(KDEInstallDirs)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
18
19
include(FeatureSummary)
include(GenerateExportHeader)
20
include(CMakePackageConfigHelpers)
21
include(KDEClangFormat)
22

Jonathan Riddell's avatar
Jonathan Riddell committed
23
ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX KDECORATION2
24
25
26
27
28
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kdecoration2_version.h"
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KDecoration2ConfigVersion.cmake"
                        SOVERSION 5)

#dependencies
29
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
30
31
    Core
    Gui
Martin Flöser's avatar
Martin Flöser committed
32
    Test
33
34
35
36
37
38
39
40
41
)

# require at least gcc 4.8
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
    if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.8")
        message(SEND_ERROR "Version ${CMAKE_CXX_COMPILER_VERSION} of the ${CMAKE_CXX_COMPILER_ID} C++ compiler is not supported. Please use version 4.8 or later.")
    endif()
endif()

42
set(KDECORATION2_INCLUDEDIR "${KDE_INSTALL_INCLUDEDIR}/KDecoration2")
43
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
44
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
45
   add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00)
46
47
   add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000)
endif()
48
49
50

# Subdirectories
add_subdirectory(src)
51
52
53
if(BUILD_TESTING)
   add_subdirectory(autotests)
endif()
54

55
56
57
58
# add clang-format target for all our real source files
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})

59
60
61
# create a Config.cmake and a ConfigVersion.cmake file and install them
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KDecoration2")

62
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KDecoration2Config.cmake.in"
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
                                  "${CMAKE_CURRENT_BINARY_DIR}/KDecoration2Config.cmake"
                                  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
                                  )

install(FILES  "${CMAKE_CURRENT_BINARY_DIR}/KDecoration2Config.cmake"
               "${CMAKE_CURRENT_BINARY_DIR}/KDecoration2ConfigVersion.cmake"
        DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
        COMPONENT Devel )

install(EXPORT KDecoration2Targets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KDecoration2Targets.cmake NAMESPACE KDecoration2:: )


install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kdecoration2_version.h
        DESTINATION ${KF5_INCLUDE_INSTALL_DIR} COMPONENT Devel )

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
79
80

ki18n_install(po)