CMakeLists.txt 2.26 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 1.0.0 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 "5.0.0")
Laurent Montel's avatar
Laurent Montel committed
21
set(KDEPIMLIBS_VERSION "4.70.0")
22

Laurent Montel's avatar
Laurent Montel committed
23
ecm_setup_version(${KDEPIMLIBS_VERSION} VARIABLE_PREFIX KPIMIDENTITIES
24
25
26
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kpimidentities_version.h"
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5PimIdentitiesConfigVersion.cmake"
                        SOVERSION 5
27
)
28

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

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

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

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

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

53
install(FILES
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  "${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
68
   DESTINATION ${KF5_INCLUDE_INSTALL_DIR}
69
70
   COMPONENT Devel
)
71

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