Debian Codegraph @

pkg-config/CMakeLists.txt

raw
1 #
2 # KIM-API: An API for interatomic models
3 # Copyright (c) 2013--2022, Regents of the University of Minnesota.
4 # All rights reserved.
5 #
6 # Contributors:
7 # Richard Berger
8 # Christoph Junghans
9 # Ryan S. Elliott
10 # Alexander Stukowski
11 #
12 # SPDX-License-Identifier: LGPL-2.1-or-later
13 #
14 # This library is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU Lesser General Public
16 # License as published by the Free Software Foundation; either
17 # version 2.1 of the License, or (at your option) any later version.
18 #
19 # This library is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 # Lesser General Public License for more details.
23 #
24 # You should have received a copy of the GNU Lesser General Public License
25 # along with this library; if not, write to the Free Software Foundation,
26 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 #
28
29 #
30 # Release: This file is part of the kim-api.git repository.
31 #
32
33
34 # use 'lib' instead of '${CMAKE_SHARED_LIBRARY_PREFIX}' here to have consistency
35 # of pkg-config usage across systems.
36 set(PKG_CONFIG_FILE "lib${PROJECT_NAME}.pc")
37
38 relocatable_path(
39 FROM "${CMAKE_INSTALL_FULL_LIBDIR}/${KIM_API_PKG_CONFIG_DIR_IDENTIFIER}" FROM_REL "${CMAKE_INSTALL_RELOC_LIBDIR}"
40 TO "${CMAKE_INSTALL_PREFIX}" TO_REL "./"
41 PREFIX "\${pcfiledir}"
42 RESULT_VARIABLE _installdir_rel
43 )
44 relocatable_path(
45 FROM "${CMAKE_INSTALL_PREFIX}" FROM_REL "./"
46 TO "${CMAKE_INSTALL_FULL_BINDIR}" TO_REL "${CMAKE_INSTALL_RELOC_BINDIR}"
47 PREFIX "\${prefix}"
48 RESULT_VARIABLE _bindir_rel
49 )
50 relocatable_path(
51 FROM "${CMAKE_INSTALL_PREFIX}" FROM_REL "./"
52 TO "${CMAKE_INSTALL_FULL_LIBEXECDIR}" TO_REL "${CMAKE_INSTALL_RELOC_LIBEXECDIR}"
53 PREFIX "\${prefix}"
54 RESULT_VARIABLE _libexecdir_rel
55 )
56 relocatable_path(
57 FROM "${CMAKE_INSTALL_PREFIX}" FROM_REL "./"
58 TO "${CMAKE_INSTALL_FULL_SYSCONFDIR}" TO_REL "${CMAKE_INSTALL_RELOC_SYSCONFDIR}"
59 PREFIX "\${prefix}"
60 RESULT_VARIABLE _sysconfdir_rel
61 )
62 relocatable_path(
63 FROM "${CMAKE_INSTALL_PREFIX}" FROM_REL "./"
64 TO "${CMAKE_INSTALL_FULL_LIBDIR}" TO_REL "${CMAKE_INSTALL_RELOC_LIBDIR}"
65 PREFIX "\${prefix}"
66 RESULT_VARIABLE _libdir_rel
67 )
68 relocatable_path(
69 FROM "${CMAKE_INSTALL_PREFIX}" FROM_REL "./"
70 TO "${CMAKE_INSTALL_FULL_INCLUDEDIR}" TO_REL "${CMAKE_INSTALL_RELOC_INCLUDEDIR}"
71 PREFIX "\${prefix}"
72 RESULT_VARIABLE _includedir_rel
73 )
74 relocatable_path(
75 FROM "${CMAKE_INSTALL_PREFIX}" FROM_REL "./"
76 TO "${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME}/${KIM_API_Fortran_MODULE_DIR_IDENTIFIER}" TO_REL "${CMAKE_INSTALL_RELOC_LIBDIR}"
77 PREFIX "\${prefix}"
78 RESULT_VARIABLE _moddir_rel
79 )
80 relocatable_path(
81 FROM "${CMAKE_INSTALL_PREFIX}" FROM_REL "./"
82 TO "${CMAKE_INSTALL_FULL_DOCDIR}" TO_REL "${CMAKE_INSTALL_RELOC_DOCDIR}"
83 PREFIX "\${prefix}"
84 RESULT_VARIABLE _docdir_rel
85 )
86 list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_FULL_LIBDIR}" _isSystemDir)
87 if("${_isSystemDir}" STREQUAL "-1")
88 set(KIM_API_RPATH_FLAG [=[-Wl,-rpath,${libdir}]=])
89 else()
90 set(KIM_API_RPATH_FLAG "")
91 endif()
92 unset(_isSystemDir)
93 configure_file(libkim-api.pc.in ${PKG_CONFIG_FILE} @ONLY)
94 unset(_installdir_rel)
95 unset(_bindir_rel)
96 unset(_libexecdir_rel)
97 unset(_sysconfdir_rel)
98 unset(_libdir_rel)
99 unset(_includedir_rel)
100 unset(_moddir_rel)
101 unset(_docdir_rel)
102
103
104 install(
105 FILES ${CMAKE_CURRENT_BINARY_DIR}/${PKG_CONFIG_FILE}
106 # use CMAKE_INSTALL_RELOC_* to get relocatable GNUInstallDir behavior
107 DESTINATION ${CMAKE_INSTALL_RELOC_LIBDIR}/${KIM_API_PKG_CONFIG_DIR_IDENTIFIER}
108 )