CMakeLists.txt 4.69 KB
Newer Older
1
cmake_minimum_required(VERSION 3.5)
Laurent Montel's avatar
Laurent Montel committed
2
set(PIM_VERSION "5.14.2")
Volker Krause's avatar
Volker Krause committed
3
project(KItinerary VERSION ${PIM_VERSION})
4

5
set(CMAKE_CXX_STANDARD 14)
6
set(KF5_MIN_VERSION "5.68.0")
7

8
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
9
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
10
11
12
13
14
15
16
17
18
19
20
21
22

include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMAddTests)
include(ECMGenerateHeaders)
include(ECMQtDeclareLoggingCategory)
include(ECMSetupVersion)
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(GenerateExportHeader)

ecm_setup_version(PROJECT VARIABLE_PREFIX KITINERARY
    VERSION_HEADER kitinerary_version.h
23
    PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KPimItineraryConfigVersion.cmake"
24
25
)

Laurent Montel's avatar
Laurent Montel committed
26
set(QT_REQUIRED_VERSION "5.12.0")
27
28


29
find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED COMPONENTS Gui Qml)
30
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n)
31
32
33
if (NOT ANDROID)
    find_package(SharedMimeInfo 1.3 REQUIRED)
endif()
34

Laurent Montel's avatar
Laurent Montel committed
35
36
set(KMIME_VERSION "5.14.2")
set(PIM_PKPASS "5.14.2")
37
38

find_package(KF5Mime ${KMIME_VERSION} CONFIG REQUIRED)
39
40
find_package(KF5CalendarCore ${KF5_MIN_VERSION} CONFIG)
find_package(KF5Contacts ${KF5_MIN_VERSION} CONFIG REQUIRED)
41
find_package(KPimPkPass ${PIM_PKPASS} CONFIG REQUIRED)
42
find_package(Poppler COMPONENTS Core)
Volker Krause's avatar
Volker Krause committed
43
set_package_properties("Poppler" PROPERTIES TYPE OPTIONAL PURPOSE "Support for extraction from PDF booking confirmations.")
44
45
find_package(ZXing CONFIG)
set_package_properties("ZXing" PROPERTIES TYPE OPTIONAL PURPOSE "Support for barcode decoding." URL "https://github.com/nu-book/zxing-cpp")
Volker Krause's avatar
Volker Krause committed
46
47
find_package(ZLIB REQUIRED)
set_package_properties("ZLIB" PROPERTIES PURPOSE "Support for decoding UIC 918-3 train tickets.")
48
49
find_package(LibXml2 MODULE)
set_package_properties("LibXml2" PROPERTIES PURPOSE "Support for extraction from HTML booking confirmations." URL "http://libxml.org")
50
51
find_package(PhoneNumber OPTIONAL_COMPONENTS PhoneNumber QUIET)
set_package_properties("PhoneNumber" PROPERTIES PURPOSE "Parsing and geo-coding of phone numbers.")
52
53
find_package(OpenSSL 1.1)
set_package_properties("OpenSSL" PROPERTIES TYPE OPTIONAL PURPOSE "VDV ticket decoding." URL "https://openssl.org")
54

55
56
57
58
59
if (NOT ANDROID)
    set_package_properties(KF5CalendarCore PROPERTIES TYPE REQUIRED)
    set_package_properties(LibXml2 PROPERTIES TYPE REQUIRED)
endif()

60
if(TARGET Poppler::Core)
61
62
63
64
65
66
67
68
69
70
    # check if we have private Poppler headers
    find_file(HAVE_POPPLER_UNSTABLE_HEADERS "OutputDev.h" PATHS ${Poppler_INCLUDE_DIRS} NO_DEFAULT_PATH)
    if (NOT HAVE_POPPLER_UNSTABLE_HEADERS)
        message(WARNING "Poppler was not build with ENABLE_UNSTABLE_API_ABI_HEADER - building without PDF support!")
        set(HAVE_POPPLER FALSE)
    else()
        set(HAVE_POPPLER TRUE)
    endif()
endif()
if (HAVE_POPPLER)
71
72
73
74
    string(REPLACE "." ";" _poppler_version_components ${Poppler_VERSION})
    list(GET _poppler_version_components 0 POPPLER_VERSION_MAJOR)
    list(GET _poppler_version_components 1 POPPLER_VERSION_MINOR)
    list(GET _poppler_version_components 2 POPPLER_VERSION_PATCH)
75
endif()
76

77
if (TARGET ZXing::ZXing OR TARGET ZXing::Core)
78
79
    set(HAVE_ZXING ON)
endif()
80

81
82
83
if (TARGET KF5::CalendarCore)
    set(HAVE_KCAL ON)
endif()
84
85
86
if (LIBXML2_FOUND)
    set(HAVE_LIBXML2 ON)
endif()
87
88
89
if (TARGET PhoneNumber::PhoneNumber)
    set(HAVE_PHONENUMBER ON)
endif()
90
if (TARGET OpenSSL::Crypto)
91
    set(HAVE_OPENSSL_RSA ON)
92
endif()
93

Volker Krause's avatar
Volker Krause committed
94
add_definitions(-DTRANSLATION_DOMAIN=\"kitinerary\")
95

96
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
97
   add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00)
98
   add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054400)
99
100
endif()

Laurent Montel's avatar
Laurent Montel committed
101
add_definitions(-DQT_NO_FOREACH)
102

Volker Krause's avatar
Volker Krause committed
103
104
105
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KPimItinerary")
set(KDE_INSTALL_INCLUDEDIR_PIM ${KDE_INSTALL_INCLUDEDIR}/KPim)

106
add_subdirectory(src)
Laurent Montel's avatar
Laurent Montel committed
107
108
109
if(BUILD_TESTING)
   add_subdirectory(autotests)
endif()
110
111
112
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

configure_package_config_file(
113
114
    "${CMAKE_CURRENT_SOURCE_DIR}/KPimItineraryConfig.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/KPimItineraryConfig.cmake"
115
116
117
118
    INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
)

install(FILES
119
120
        "${CMAKE_CURRENT_BINARY_DIR}/KPimItineraryConfig.cmake"
        "${CMAKE_CURRENT_BINARY_DIR}/KPimItineraryConfigVersion.cmake"
121
122
123
        DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
        COMPONENT Devel)

124
install(EXPORT KPimItineraryTargets
125
        DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
126
127
        FILE KPimItineraryTargets.cmake
        NAMESPACE KPim::
128
)
129
install(FILES org_kde_kitinerary.categories  DESTINATION  ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
Volker Krause's avatar
Volker Krause committed
130
131
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kitinerary_version.h
        DESTINATION ${KDE_INSTALL_INCLUDEDIR_PIM} COMPONENT Devel)
132
ki18n_install(po)