CMakeLists.txt 2.08 KB
Newer Older
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
1
cmake_minimum_required(VERSION 2.8.12)
2

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
3
project(KHolidays)
Àlex Fiestas's avatar
Àlex Fiestas committed
4

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
5
# ECM setup
6
set(KF5_VERSION "5.23.0")
Laurent Montel's avatar
Laurent Montel committed
7
find_package(ECM ${KF5_VERSION} CONFIG REQUIRED)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
8
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
Laurent Montel's avatar
Laurent Montel committed
9

10
include(GenerateExportHeader)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
11 12 13 14
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
include(ECMPackageConfigHelpers)
include(ECMSetupVersion)
15
include(ECMPoQmTools)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
16 17 18
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
19
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
Allen Winter's avatar
Allen Winter committed
20

Laurent Montel's avatar
Laurent Montel committed
21
set(PIM_VERSION "5.3.40")
22

Laurent Montel's avatar
Laurent Montel committed
23
set(KHOLIDAYS_LIB_VERSION ${PIM_VERSION})
24

Laurent Montel's avatar
Laurent Montel committed
25
ecm_setup_version(${KHOLIDAYS_LIB_VERSION} VARIABLE_PREFIX KHOLIDAYS
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
26 27 28
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kholidays_version.h"
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5HolidaysConfigVersion.cmake"
                        SOVERSION 5
29 30
)

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
31
########### Find packages ###########
Laurent Montel's avatar
Laurent Montel committed
32
set(REQUIRED_QT_VERSION 5.4.0)
Martin Klapetek's avatar
Martin Klapetek committed
33
find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Core Qml)
34

Laurent Montel's avatar
Laurent Montel committed
35
remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII)
Laurent Montel's avatar
Laurent Montel committed
36

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
37 38
########### Targets ###########
add_subdirectory(src)
39 40 41 42 43

if(BUILD_TESTING)
    add_subdirectory(autotests)
endif()

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
44
add_subdirectory(holidays)
45

46 47 48 49
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po")
   ecm_install_po_files_as_qm(po)
endif()

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
50
########### CMake Config Files ###########
51
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Holidays")
52

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
53 54 55 56
ecm_configure_package_config_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/KF5HolidaysConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5HolidaysConfig.cmake"
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
Allen Winter's avatar
Allen Winter committed
57 58
)

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
59 60 61 62 63 64
install(FILES
  "${CMAKE_CURRENT_BINARY_DIR}/KF5HolidaysConfig.cmake"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5HolidaysConfigVersion.cmake"
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)
65

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
66
install(EXPORT KF5HolidaysTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5HolidaysTargets.cmake NAMESPACE KF5::)
67

68
install(FILES
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
69
   ${CMAKE_CURRENT_BINARY_DIR}/kholidays_version.h
70
  DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
71
)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
72

Laurent Montel's avatar
Laurent Montel committed
73
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)