File: CMakeLists.txt

package info (click to toggle)
kbibtex 0.9.90-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 23,072 kB
  • sloc: cpp: 40,314; python: 450; xml: 372; sh: 150; makefile: 12
file content (219 lines) | stat: -rw-r--r-- 5,344 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
cmake_minimum_required(VERSION 3.7.2)

if(POLICY CMP0048)
    cmake_policy(SET CMP0048 NEW)
endif(POLICY CMP0048)

project(
    kbibtex
    VERSION 0.9.90
    LANGUAGES CXX
)

set(CMAKE_CXX_STANDARD 11)
set(QT_MIN_VERSION 5.9.0)
# Somewhat arbitrary chosen version number ...
set(KF5_MIN_VERSION 5.51)
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)

set(
    CMAKE_MODULE_PATH
    ${ECM_MODULE_PATH}
    ${ECM_KDE_MODULE_DIR}
    ${CMAKE_MODULE_PATH}
)

set(KDE_INSTALL_DIRS_NO_DEPRECATED TRUE)
include(KDEInstallDirs)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(ECMGenerateHeaders)
include(ECMInstallIcons)
include(ECMSetupVersion)
include(ECMAddAppIcon)
include(GenerateExportHeader)
include(ECMQtDeclareLoggingCategory)

ecm_setup_version(
    PROJECT
    VARIABLE_PREFIX KBIBTEX
    SOVERSION ${KBIBTEX_VERSION_MAJOR}
    VERSION_HEADER "${CMAKE_BINARY_DIR}/kbibtex-version.h"
    PACKAGE_VERSION_FILE "${CMAKE_BINARY_DIR}/KBibTeXConfigVersion.cmake"
)

install(
    FILES ${CMAKE_BINARY_DIR}/kbibtex-version.h
    DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KBibTeX
    # FIXME is "Devel" standard?
    COMPONENT Devel
)


if("${KBIBTEX_VERSION_PATCH}" STREQUAL "")
    # Patch level is not set for version numbers like "0.9",
    # so set the patch level manually to 0
    set(KBIBTEX_VERSION_PATCH 0)
endif()

if((${KBIBTEX_VERSION_PATCH} GREATER 50) OR (${KBIBTEX_VERSION_PATCH} EQUAL 50))
    # If the version number indicates a pre-release version such as
    # '0.7.90', i.e. a beta version for the major release 0.8,
    # increment release version from 0.7 to 0.8
    math(EXPR KBIBTEX_RELEASE_VERSION_MINOR "${KBIBTEX_VERSION_MINOR} + 1")
    set(
        KBIBTEX_RELEASE_VERSION ${KBIBTEX_VERSION_MAJOR}.${KBIBTEX_RELEASE_VERSION_MINOR}
    )
else()
    set(
        KBIBTEX_RELEASE_VERSION ${KBIBTEX_VERSION_MAJOR}.${KBIBTEX_VERSION_MINOR}
    )
endif()

option(
    UNITY_BUILD
    "Compile multiple C++ files in one big, merged file (\"Unity build\")\nSee also http://t-fischer.dreamwidth.org/3054.html"
)
if(UNITY_BUILD)
    message(STATUS "Unity build enabled")
else(UNITY_BUILD)
    message(STATUS "Unity build disabled (default), use option UNITY_BUILD to enable it")
endif(UNITY_BUILD)

find_package(
    Qt5 ${QT_MIN_VERSION}
    CONFIG
    COMPONENTS
    Core
    Widgets
    Network
    XmlPatterns
    Concurrent
    NetworkAuth
    OPTIONAL_COMPONENTS
    WebEngineWidgets
    WebKitWidgets
    Test
)
add_definitions(-DHAVE_QTWIDGETS)
if(Qt5WebEngineWidgets_FOUND)
    # Once CMake 3.12.x is minimum requirement, use 'add_compile_definitions'
    add_definitions(
        -DHAVE_WEBENGINEWIDGETS
    )
endif()

find_package(
    KF5 ${KF5_MIN_VERSION}
    MODULE
    REQUIRED
    I18n
    XmlGui
    KIO
    IconThemes
    Parts
    CoreAddons
    Service
    Wallet
    Crash
    TextEditor
    OPTIONAL_COMPONENTS
    DocTools
)
add_definitions(-DHAVE_KF5)

find_package(
    Poppler
    MODULE
    REQUIRED
    Qt5
)

find_package(
    ICU
    MODULE
    OPTIONAL_COMPONENTS
    uc i18n
)
if(ICU_FOUND)
    add_definitions(-DHAVE_ICU)
endif()

option(
    BUILD_TESTING
    "Build automated and interactive tests"
    OFF
)
if (MSVC)
    MESSAGE( STATUS "Disabling building tests when using Microsoft Visual Studio C++ compiler" )
    # Note to any developer: Try to enable building tests and see which issues you may encounter.
    # Examples may include: (1) char* texts which exceed the size limit supported by MSVC which
    # is about 2^16 bytes and (2) characters in strings written in \uXXXX notation not supported
    # in 1252 encoding as assumed by MSVC for C++ source files.
    set(BUILD_TESTING OFF)
endif()
if(NOT BUILD_TESTING AND Qt5Test_FOUND)
    message(STATUS
        "Testing is disabled, but can be enabled as the Qt5::Test library is available"
    )
endif()
if(BUILD_TESTING AND NOT Qt5Test_FOUND)
    message(STATUS
        "Disabling building tests as Qt5::Test library is not available"
    )
    set(BUILD_TESTING OFF)
endif()

if(BUILD_TESTING)
    if (WRITE_RAWDATAFILE)
        add_definitions(-DWRITE_RAWDATAFILE)
    endif(WRITE_RAWDATAFILE)

    set(
        TESTSET_DIRECTORY ""
        CACHE PATH
        "Directory where the local checkout of Git repository 'kbibtex-testset' is located"
    )
endif()

if(TESTSET_DIRECTORY AND ( NOT EXISTS "${TESTSET_DIRECTORY}/bib/minix.bib" OR NOT EXISTS "${TESTSET_DIRECTORY}/bib/backslash.bib" ))
    message("Variable TESTSET_DIRECTORY is set to '${TESTSET_DIRECTORY}' but various BibTeX files were not found. Unsetting TESTSET_DIRECTORY.")
    unset(TESTSET_DIRECTORY)
    unset(TESTSET_DIRECTORY CACHE)
endif()


add_subdirectory(
    config
)
add_subdirectory(
    src
)
add_subdirectory(
    xslt
)
add_subdirectory(
    mime
)
if(KF5DocTools_FOUND)
    add_subdirectory(doc)
endif()
# macro_optional_add_subdirectory(
#     po
# )

if (ECM_VERSION VERSION_GREATER_EQUAL "5.59.0")
    install(FILES kbibtex.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
else()
    install(FILES kbibtex.categories DESTINATION ${KDE_INSTALL_CONFDIR})
endif()

feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

find_package(KF5I18n CONFIG REQUIRED)
ki18n_install(po)

  find_package(KF5DocTools CONFIG)
  if(KF5DocTools_FOUND)
    kdoctools_install(po)
  endif()