1#   BAREOS® - Backup Archiving REcovery Open Sourced
2#
3#   Copyright (C) 2017-2019 Bareos GmbH & Co. KG
4#
5#   This program is Free Software; you can redistribute it and/or
6#   modify it under the terms of version three of the GNU Affero General Public
7#   License as published by the Free Software Foundation and included
8#   in the file LICENSE.
9#
10#   This program is distributed in the hope that it will be useful, but
11#   WITHOUT ANY WARRANTY; without even the implied warranty of
12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13#   Affero General Public License for more details.
14#
15#   You should have received a copy of the GNU Affero General Public License
16#   along with this program; if not, write to the Free Software
17#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18#   02110-1301, USA.
19
20# The ${libdir} and ${backenddir} are absolute, so figure out
21# a relative path (${backenddir} lives under ${libdir}) instead.
22# Make the link relative, placing the libbareoscats.so in ${libdir}.
23# Within this script, VERSION is set to BAREOS_NUMERIC_VERSION (see
24# core/src/cats/CMakeLists.txt).
25message(
26  STATUS
27    "${CMAKE_COMMAND} -E create_symlink ${libdir}/libbareoscats${CMAKE_SHARED_LIBRARY_SUFFIX} ${backenddir}/libbareoscats-${default_db_backend}${CMAKE_SHARED_LIBRARY_SUFFIX}"
28)
29file(
30  RELATIVE_PATH
31    _rel
32    ${libdir}
33    ${backenddir}/libbareoscats-${default_db_backend}${CMAKE_SHARED_LIBRARY_SUFFIX}
34)
35message(
36  STATUS
37    ".. actually ${_rel} in $ENV{DESTDIR} v ${VERSION}"
38)
39
40execute_process(
41  COMMAND
42    ${CMAKE_COMMAND} -E create_symlink
43    ${_rel}
44    libbareoscats${CMAKE_SHARED_LIBRARY_SUFFIX}.${VERSION}
45    WORKING_DIRECTORY $ENV{DESTDIR}${libdir} COMMAND_ECHO STDOUT
46)
47