CMakeLists.txt 2.76 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 ###########
Laurent Montel's avatar
Laurent Montel committed
30
#REMOVE IT WHEN WE REMOVE from KF5PimTextEdit or KF5PimUtils
Laurent Montel's avatar
Laurent Montel committed
31
find_package(KF5KDELibs4Support ${KF5_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
32
33
34
35
36
37
38

find_package(Qt5Network NO_MODULE REQUIRED)
find_package(KF5CoreAddons ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5KIO ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Completion ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5TextWidgets ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_VERSION} CONFIG REQUIRED)
39
find_package(KF5KIO ${KF5_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
40
41
find_package(KF5Config ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Emoticons ${KF5_VERSION} CONFIG REQUIRED)
Christophe Giboudeaux's avatar
Cleanup    
Christophe Giboudeaux committed
42

43
if("${CMAKE_SOURCE_DIR}" STREQUAL "${KPimIdentities_SOURCE_DIR}")
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
44
45
  find_package(KF5PimTextEdit ${KDEPIMLIBS_VERSION} CONFIG REQUIRED)
  find_package(KF5PimUtils ${KDEPIMLIBS_VERSION} CONFIG REQUIRED)
Christophe Giboudeaux's avatar
Cleanup    
Christophe Giboudeaux committed
46
endif()
47
add_definitions(-DTRANSLATION_DOMAIN=\"libkpimidentities5\")
48
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
49
50
51

########### Targets ###########
add_subdirectory(src)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
52
add_subdirectory(autotests)
53

54
55
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5PimIdentities")
56

57
58
59
60
61
ecm_configure_package_config_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/KF5PimIdentitiesConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5PimIdentitiesConfig.cmake"
  INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
62

63
install(FILES
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  "${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
78
   DESTINATION ${KF5_INCLUDE_INSTALL_DIR}
79
80
   COMPONENT Devel
)
81

82
83
84
if ("${CMAKE_BINARY_DIR}" STREQUAL "${KPimIdentities_BINARY_DIR}")
  feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
endif()