CMakeLists.txt 2.21 KB
Newer Older
1
cmake_minimum_required(VERSION 2.8.12)
2

3
project(KPimIdentities)
4

5
# ECM setup
Laurent Montel's avatar
Laurent Montel committed
6
find_package(ECM 0.0.13 CONFIG REQUIRED)
7
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
8

9
10
11
12
13
14
15
16
17
include(GenerateExportHeader)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
include(ECMPackageConfigHelpers)
include(ECMSetupVersion)
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings)
18
19


Laurent Montel's avatar
Laurent Montel committed
20
set(KF5_VERSION "4.98.0")
21
22
23
24
25

ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KPIMIDENTITIES
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kpimidentities_version.h"
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5PimIdentitiesConfigVersion.cmake"
                        SOVERSION 5
26
)
27

28
########### Find packages ###########
29
find_package(KF5CoreAddons ${KF5_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
30
find_package(KF5KDELibs4Support ${KF5_VERSION} CONFIG REQUIRED)
31
find_package(KF5KIO ${KF5_VERSION} CONFIG REQUIRED)
Christophe Giboudeaux's avatar
Cleanup    
Christophe Giboudeaux committed
32

33
if("${CMAKE_SOURCE_DIR}" STREQUAL "${KPimIdentities_SOURCE_DIR}")
Christophe Giboudeaux's avatar
Cleanup    
Christophe Giboudeaux committed
34
  find_package(KF5PimTextEdit ${KF5_VERSION} CONFIG REQUIRED)
35
  find_package(KF5PimUtils ${KF5_VERSION} CONFIG REQUIRED)
Christophe Giboudeaux's avatar
Cleanup    
Christophe Giboudeaux committed
36
endif()
Laurent Montel's avatar
Laurent Montel committed
37
add_definitions(-DTRANSLATION_DOMAIN=\"libkpimidentities\")
38
39
40

########### Targets ###########
add_subdirectory(src)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
41
add_subdirectory(autotests)
42

43
44
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5PimIdentities")
45

46
47
48
49
50
ecm_configure_package_config_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/KF5PimIdentitiesConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5PimIdentitiesConfig.cmake"
  INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
51

52
install(FILES
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  "${CMAKE_CURRENT_BINARY_DIR}/KF5PimIdentitiesConfig.cmake"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5PimIdentitiesConfigVersion.cmake"
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)

install(EXPORT KF5PimIdentitiesTargets
    DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
    FILE KF5PimIdentitiesTargets.cmake
    NAMESPACE KF5::
)

install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/kpimidentities_version.h
67
   DESTINATION ${KF5_INCLUDE_INSTALL_DIR}
68
69
   COMPONENT Devel
)
70

71
72
73
if ("${CMAKE_BINARY_DIR}" STREQUAL "${KPimIdentities_BINARY_DIR}")
  feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
endif()