forked from lxqt/lxqt-build-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
154 lines (129 loc) · 5.29 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
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# CMP0000: Call the cmake_minimum_required() command at the beginning of the top-level
# CMakeLists.txt file even before calling the project() command.
# The cmake_minimum_required(VERSION) command implicitly invokes the cmake_policy(VERSION)
# command to specify that the current project code is written for the given range of CMake
# versions.
project(lxqt-build-tools)
option(WITH_XDG_DIRS_FALLBACK "Use our XDG_CONFIG_DIRS fallback" ON)
set(LXQT_BUILD_TOOLS_MAJOR_VERSION 0)
set(LXQT_BUILD_TOOLS_MINOR_VERSION 12)
set(LXQT_BUILD_TOOLS_PATCH_VERSION 0)
set(LXQT_BUILD_TOOLS_VERSION ${LXQT_BUILD_TOOLS_MAJOR_VERSION}.${LXQT_BUILD_TOOLS_MINOR_VERSION}.${LXQT_BUILD_TOOLS_PATCH_VERSION})
set(LXQT_MIN_LINGUIST_VERSION "5.15.0")
include(CMakePackageConfigHelpers)
include(GNUInstallDirs) # Standard directories for installation
include(cmake/FindInstallConfigPath.cmake) # sets LXQT_ETC_XDG_DIR, if unset
include(cmake/modules/LXQtPreventInSourceBuilds.cmake)
#-----------------------------------------------------------------------------
# LXQT_DATA_DIR defaults to CMAKE_INSTALL_FULL_DATADIR. It's added to
# XDG_DATA_DIRS by the startlxqt script
# Warning: Setting LXQT_DATA_DIR must be done after including GNUInstallDirs
#-----------------------------------------------------------------------------
if (NOT DEFINED LXQT_DATA_DIR)
set(LXQT_DATA_DIR "${CMAKE_INSTALL_FULL_DATADIR}" CACHE PATH
"LXQt base directory relative to which data files should be searched"
)
endif()
set(LXQT_LIBRARY_NAME "lxqt" CACHE STRING "lxqt")
set(LXQT_RELATIVE_SHARE_DIR "${LXQT_LIBRARY_NAME}")
set(LXQT_SHARE_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/${LXQT_RELATIVE_SHARE_DIR}")
set(LXQT_RELATIVE_TRANSLATIONS_DIR "${LXQT_LIBRARY_NAME}/translations")
set(LXQT_TRANSLATIONS_DIR "${LXQT_SHARE_DIR}/translations")
set(LXQT_GRAPHICS_DIR "${LXQT_SHARE_DIR}/graphics")
file(GLOB toInstallFindModules
"${PROJECT_SOURCE_DIR}/cmake/find-modules/*.cmake"
)
file(GLOB toInstallModules
"${PROJECT_SOURCE_DIR}/cmake/modules/*.cmake"
"${PROJECT_SOURCE_DIR}/cmake/modules/*.cpp.in"
)
file(GLOB toInstallModulesHelpers
"${PROJECT_SOURCE_DIR}/cmake/modules/*.pl"
)
#-----------------------------------------------------------------------------
# Superbuild mode
#-----------------------------------------------------------------------------
set(FIND_MODULES_INSTALL_DIR "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/lxqt-build-tools/cmake/find-modules/")
set(MODULES_INSTALL_DIR "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/lxqt-build-tools/cmake/modules/")
file(COPY
${toInstallFindModules}
DESTINATION "${FIND_MODULES_INSTALL_DIR}"
)
file(COPY
${toInstallModules}
${toInstallModulesHelpers}
DESTINATION "${MODULES_INSTALL_DIR}"
)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/lxqt-build-tools-config.cmake.in"
"${CMAKE_BINARY_DIR}/lxqt-build-tools-config.cmake"
INSTALL_DESTINATION "neverland" # required, altough we don't install it
PATH_VARS
MODULES_INSTALL_DIR
FIND_MODULES_INSTALL_DIR
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/LXQtConfigVars.cmake.in"
"${MODULES_INSTALL_DIR}/LXQtConfigVars.cmake"
@ONLY
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/LXQtTranslateTs.cmake.in"
"${MODULES_INSTALL_DIR}/LXQtTranslateTs.cmake"
@ONLY
)
#-----------------------------------------------------------------------------
# Installable mode
#-----------------------------------------------------------------------------
set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake/lxqt-build-tools/")
set(FIND_MODULES_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake/lxqt-build-tools/find-modules/")
set(MODULES_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake/lxqt-build-tools/modules/")
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/lxqt-build-tools-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/install/lxqt-build-tools-config.cmake"
INSTALL_DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
PATH_VARS
MODULES_INSTALL_DIR
FIND_MODULES_INSTALL_DIR
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/LXQtConfigVars.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/install/LXQtConfigVars.cmake"
@ONLY
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/LXQtTranslateTs.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/install/LXQtTranslateTs.cmake"
@ONLY
)
# The package version file is common to superbuild and installable mode
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/lxqt-build-tools-config-version.cmake.in"
"${CMAKE_BINARY_DIR}/lxqt-build-tools-config-version.cmake"
@ONLY
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/install/lxqt-build-tools-config.cmake"
"${CMAKE_BINARY_DIR}/lxqt-build-tools-config-version.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
)
install(
FILES ${toInstallFindModules}
DESTINATION "${FIND_MODULES_INSTALL_DIR}"
)
install(
FILES
${toInstallModules}
${toInstallModulesHelpers}
"${CMAKE_CURRENT_BINARY_DIR}/install/LXQtConfigVars.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/install/LXQtTranslateTs.cmake"
DESTINATION
"${MODULES_INSTALL_DIR}"
)
# Tools install
install(
PROGRAMS
"lxqt-transupdate"
DESTINATION
"${CMAKE_INSTALL_BINDIR}")