forked from jrl-umi3218/jrl-cmakemodules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpack.cmake
94 lines (86 loc) · 3.04 KB
/
cpack.cmake
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
# Copyright (C) 2008-2014 LAAS-CNRS, JRL AIST-CNRS.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
# ADD_CMAKE_DEPENDENCY
# --------------------
#
# Warning: use on this macro if NECESSARY.
#
# This macro adds CPack dependencies support to the package. It should be
# avoided unless Ubuntu 8.04 packages have to be built.
#
# Please, prefer the use of git-archive for tarball generation and debhelper for
# Debian package generation.
#
macro(ADD_CMAKE_DEPENDENCY PKG_CONFIG_STRING)
message(STATUS "PKG_CONFIG_STRING: ${PKG_CONFIG_STRING}")
string(REGEX MATCH "[^<>= ]+" LIBRARY_NAME "${PKG_CONFIG_STRING}")
# Carefull the space in front of the matching string is important to avoid
# confusion with package name.
string(
REGEX MATCHALL
" [0-9]+.[0-9]+(.[a-z0-9-])*"
VERSION
"${PKG_CONFIG_STRING}"
)
_add_to_list(CPACK_INTERNAL_CONFIG_REQUIRES "${LIBRARY_NAME}(>=${VERSION})"
","
)
endmacro(ADD_CMAKE_DEPENDENCY)
# SETUP_PROJECT_CPACK
# -------------------
#
# Warning: use only this macro if NECESSARY.
#
# This macro adds CPack support to the package. It should be avoided unless
# Ubuntu 8.04 packages have to be built.
#
# Please, prefer the use of git-archive for tarball generation and debhelper for
# Debian package generation.
#
macro(SETUP_PROJECT_CPACK)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROJECT_DESCRIPTION})
set(CPACK_PACKAGE_VENDOR "JRL CNRS/AIST")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_DESCRIPTION_FILE ${PROJECT_SOURCE_DIR}/README.md)
set(
CPACK_DEBIAN_PACKAGE_MAINTAINER
"Olivier Stasse ([email protected])"
)
# The following components are regex's to match anywhere (unless anchored) in
# absolute path + filename to find files or directories to be excluded from
# source tarball.
set(
CPACK_SOURCE_IGNORE_FILES
"~$"
"^${PROJECT_SOURCE_DIR}/build/"
"^${PROJECT_SOURCE_DIR}/.git/"
)
set(
CPACK_SOURCE_PACKAGE_FILE_NAME
"${PROJECT_NAME}-src-${PROJECT_VERSION}"
CACHE INTERNAL
"tarball basename"
)
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_BINARY_DEB ON)
set(CPACK_GENERATOR TGZ)
set(CPACK_GENERATOR DEB)
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/openrobots")
# Set dependencies
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_INTERNAL_CONFIG_REQUIRES}")
# CPack SHOULD be called after setting all the variables. SETUP_PROJECT_CPACK
# is supposed to be called only once for a project.
include(CPack)
endmacro(SETUP_PROJECT_CPACK)