forked from KDE/extra-cmake-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
165 lines (126 loc) · 3.59 KB
/
CMakeLists.txt
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
#=============================================================================
# Copyright 2006-2013 Alex Neundorf <[email protected]>
# Copyright 2014-2015 Alex Merry <[email protected]>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file COPYING-CMAKE-SCRIPTS for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
#
# Preliminary setup
#
set(VERSION "5.21.0") # handled by release scripts
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
project(ECM
VERSION "${VERSION}"
LANGUAGES NONE
)
else()
project(ECM NONE)
include("${CMAKE_SOURCE_DIR}/modules/ECMSetupVersion.cmake")
ecm_setup_version(
"${VERSION}"
VARIABLE_PREFIX ECM
)
endif()
#
# Includes
#
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(FeatureSummary)
#
# Installation paths
#
set(SHARE_INSTALL_DIR share
CACHE
PATH
"read-only architecture-independent data"
)
set(CMAKECONFIG_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/cmake/)
set(FIND_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/find-modules/)
set(KDE_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/kde-modules/)
set(MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/modules/)
set(TOOLCHAIN_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/ECM/toolchain/)
set(DOC_INSTALL_DIR ${SHARE_INSTALL_DIR}/doc/ECM
CACHE
PATH
"HTML and QtHelp documentation"
)
set(MAN_INSTALL_DIR ${SHARE_INSTALL_DIR}/man
CACHE
PATH
"man pages"
)
#
# Documentation
#
add_subdirectory(docs)
#
# Tests
#
option(BUILD_TESTING "Build automated tests." ON)
add_feature_info(BUILD_TESTING BUILD_TESTING "Build automated tests.")
if(BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()
#
# Install modules
#
file(GLOB installModuleFiles ${CMAKE_SOURCE_DIR}/modules/*[^~])
install(FILES ${installModuleFiles} DESTINATION ${MODULES_INSTALL_DIR})
file(GLOB installKdeModuleFiles ${CMAKE_SOURCE_DIR}/kde-modules/*[^~])
install(FILES ${installKdeModuleFiles} DESTINATION ${KDE_MODULES_INSTALL_DIR})
file(GLOB installFindModuleFiles ${CMAKE_SOURCE_DIR}/find-modules/*[^~])
install(FILES ${installFindModuleFiles} DESTINATION ${FIND_MODULES_INSTALL_DIR})
file(GLOB installToolchainModuleFiles ${CMAKE_SOURCE_DIR}/toolchain/*[^~])
install(FILES ${installToolchainModuleFiles} DESTINATION ${TOOLCHAIN_MODULES_INSTALL_DIR})
#
# Config.cmake file
#
include(CMakePackageConfigHelpers)
configure_package_config_file(
ECMConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/ECMConfig.cmake
INSTALL_DESTINATION
${CMAKECONFIG_INSTALL_DIR}
PATH_VARS
FIND_MODULES_INSTALL_DIR
KDE_MODULES_INSTALL_DIR
MODULES_INSTALL_DIR
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/ECMConfigVersion.cmake
VERSION
"${PROJECT_VERSION}"
COMPATIBILITY
AnyNewerVersion
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/ECMConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/ECMConfigVersion.cmake
DESTINATION
${CMAKECONFIG_INSTALL_DIR}
)
#
# Packaging
#
set(CPACK_PACKAGE_NAME extra-cmake-modules)
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_SYSTEM_NAME "generic")
set(CPACK_GENERATOR "TGZ")
set(CPACK_SET_DESTDIR FALSE)
include(CPack)
#
# Feature summary
#
feature_summary(
FATAL_ON_MISSING_REQUIRED_PACKAGES
WHAT ALL
)