CMakeLists.txt 2.25 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
2
3
4
5
cmake_minimum_required(VERSION 2.8.12)

project(KAlarmCal)

# ECM setup
Laurent Montel's avatar
Laurent Montel committed
6
find_package(ECM 0.0.14 CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
7
8
9
10
11
12
13
14
15
16
17
18
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})

include(GenerateExportHeader)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
include(ECMPackageConfigHelpers)
include(ECMSetupVersion)
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings)

Laurent Montel's avatar
Laurent Montel committed
19
set(KF5_VERSION "4.98.0")
Laurent Montel's avatar
Laurent Montel committed
20
21
22

ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KALARMCAL
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kalarmcal_version.h"
23
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5AlarmCalendarConfigVersion.cmake"
Laurent Montel's avatar
Laurent Montel committed
24
25
26
27
28
29
                        SOVERSION 5
)

add_definitions(-DKDE_DEFAULT_DEBUG_AREA=5955)

########### Find packages ###########
Laurent Montel's avatar
Laurent Montel committed
30
find_package(KF5KDELibs4Support ${KF5_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
31
32
find_package(KF5KIO ${KF5_VERSION} CONFIG REQUIRED)

Laurent Montel's avatar
Laurent Montel committed
33
if(${CMAKE_SOURCE_DIR} STREQUAL ${KAlarmCal_SOURCE_DIR})
34
35
  find_package(KF5Akonadi ${KF5_VERSION} CONFIG REQUIRED)
  find_package(KF5CalendarCore ${KF5_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
36
37
  find_package(KF5PimIdentities ${KF5_VERSION} CONFIG REQUIRED)
  find_package(KF5Holidays ${KF5_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
38
39
endif()

40
add_definitions(-DTRANSLATION_DOMAIN=\"libkalarmcal5\")
Laurent Montel's avatar
Laurent Montel committed
41

Laurent Montel's avatar
Laurent Montel committed
42
43
44
45
46
########### Targets ###########

add_subdirectory(src)

########### CMake Config Files ###########
47
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5AlarmCalendar")
Laurent Montel's avatar
Laurent Montel committed
48
49

ecm_configure_package_config_file(
50
51
  "${CMAKE_CURRENT_SOURCE_DIR}/KF5AlarmCalendarConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5AlarmCalendarConfig.cmake"
Laurent Montel's avatar
Laurent Montel committed
52
53
54
55
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
)

install(FILES
56
57
  "${CMAKE_CURRENT_BINARY_DIR}/KF5AlarmCalendarConfig.cmake"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5AlarmCalendarConfigVersion.cmake"
Laurent Montel's avatar
Laurent Montel committed
58
59
60
61
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)

62
install(EXPORT KF5AlarmCalendarTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5AlarmCalendarTargets.cmake NAMESPACE KF5::)
Laurent Montel's avatar
Laurent Montel committed
63
64
65

install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/kalarmcal_version.h
66
  DESTINATION ${KF5_INCLUDE_INSTALL_DIR} COMPONENT Devel
Laurent Montel's avatar
Laurent Montel committed
67
68
69
70
71
72
)

if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
  feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
endif()