]> granicus.if.org Git - icinga2/blob - cmake/GNUInstallDirs.cmake
Fix the .bundle validation.
[icinga2] / cmake / GNUInstallDirs.cmake
1 #.rst:
2 # GNUInstallDirs
3 # --------------
4 #
5 # Define GNU standard installation directories
6 #
7 # Provides install directory variables as defined for GNU software:
8 #
9 # ::
10 #
11 #   http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
12 #
13 # Inclusion of this module defines the following variables:
14 #
15 # ::
16 #
17 #   CMAKE_INSTALL_<dir>      - destination for files of a given type
18 #   CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
19 #
20 # where <dir> is one of:
21 #
22 # ::
23 #
24 #   BINDIR           - user executables (bin)
25 #   SBINDIR          - system admin executables (sbin)
26 #   LIBEXECDIR       - program executables (libexec)
27 #   SYSCONFDIR       - read-only single-machine data (etc)
28 #   SHAREDSTATEDIR   - modifiable architecture-independent data (com)
29 #   LOCALSTATEDIR    - modifiable single-machine data (var)
30 #   LIBDIR           - object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)
31 #   INCLUDEDIR       - C header files (include)
32 #   OLDINCLUDEDIR    - C header files for non-gcc (/usr/include)
33 #   DATAROOTDIR      - read-only architecture-independent data root (share)
34 #   DATADIR          - read-only architecture-independent data (DATAROOTDIR)
35 #   INFODIR          - info documentation (DATAROOTDIR/info)
36 #   LOCALEDIR        - locale-dependent data (DATAROOTDIR/locale)
37 #   MANDIR           - man documentation (DATAROOTDIR/man)
38 #   DOCDIR           - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
39 #
40 # Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION
41 # options of install() commands for the corresponding file type.  If the
42 # includer does not define a value the above-shown default will be used
43 # and the value will appear in the cache for editing by the user.  Each
44 # CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
45 # from the corresponding destination by prepending (if necessary) the
46 # value of CMAKE_INSTALL_PREFIX.
47
48 #=============================================================================
49 # Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
50 # Copyright 2011 Kitware, Inc.
51 #
52 # Distributed under the OSI-approved BSD License (the "License");
53 # see accompanying file Copyright.txt for details.
54 #
55 # This software is distributed WITHOUT ANY WARRANTY; without even the
56 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
57 # See the License for more information.
58 #=============================================================================
59 # (To distribute this file outside of CMake, substitute the full
60 #  License text for the above reference.)
61
62 # Installation directories
63 #
64 if(NOT DEFINED CMAKE_INSTALL_BINDIR)
65   set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
66 endif()
67
68 if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
69   set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
70 endif()
71
72 if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
73   set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
74 endif()
75
76 if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
77   set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
78 endif()
79
80 if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
81   set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
82 endif()
83
84 if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
85   set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
86 endif()
87
88 if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
89   set(_LIBDIR_DEFAULT "lib")
90   # Override this default 'lib' with 'lib64' iff:
91   #  - we are on Linux system but NOT cross-compiling
92   #  - we are NOT on debian
93   #  - we are on a 64 bits system
94   # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
95   # For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
96   # CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
97   # See http://wiki.debian.org/Multiarch
98   if(CMAKE_SYSTEM_NAME MATCHES "Linux"
99       AND NOT CMAKE_CROSSCOMPILING)
100     if (EXISTS "/etc/debian_version") # is this a debian system ?
101        if(CMAKE_LIBRARY_ARCHITECTURE)
102          set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
103        endif()
104     else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
105       if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
106         message(AUTHOR_WARNING
107           "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
108           "Please enable at least one language before including GNUInstallDirs.")
109       else()
110         if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
111           set(_LIBDIR_DEFAULT "lib64")
112         endif()
113       endif()
114     endif()
115   endif()
116   set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
117 endif()
118
119 if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
120   set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
121 endif()
122
123 if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
124   set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
125 endif()
126
127 if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
128   set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
129 endif()
130
131 #-----------------------------------------------------------------------------
132 # Values whose defaults are relative to DATAROOTDIR.  Store empty values in
133 # the cache and store the defaults in local variables if the cache values are
134 # not set explicitly.  This auto-updates the defaults as DATAROOTDIR changes.
135
136 if(NOT CMAKE_INSTALL_DATADIR)
137   set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
138   set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
139 endif()
140
141 if(NOT CMAKE_INSTALL_INFODIR)
142   set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
143   set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
144 endif()
145
146 if(NOT CMAKE_INSTALL_LOCALEDIR)
147   set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
148   set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
149 endif()
150
151 if(NOT CMAKE_INSTALL_MANDIR)
152   set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
153   set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
154 endif()
155
156 if(NOT CMAKE_INSTALL_DOCDIR)
157   set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
158   set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
159 endif()
160
161 #-----------------------------------------------------------------------------
162
163 mark_as_advanced(
164   CMAKE_INSTALL_BINDIR
165   CMAKE_INSTALL_SBINDIR
166   CMAKE_INSTALL_LIBEXECDIR
167   CMAKE_INSTALL_SYSCONFDIR
168   CMAKE_INSTALL_SHAREDSTATEDIR
169   CMAKE_INSTALL_LOCALSTATEDIR
170   CMAKE_INSTALL_LIBDIR
171   CMAKE_INSTALL_INCLUDEDIR
172   CMAKE_INSTALL_OLDINCLUDEDIR
173   CMAKE_INSTALL_DATAROOTDIR
174   CMAKE_INSTALL_DATADIR
175   CMAKE_INSTALL_INFODIR
176   CMAKE_INSTALL_LOCALEDIR
177   CMAKE_INSTALL_MANDIR
178   CMAKE_INSTALL_DOCDIR
179   )
180
181 # Result directories
182 #
183 foreach(dir
184     BINDIR
185     SBINDIR
186     LIBEXECDIR
187     SYSCONFDIR
188     SHAREDSTATEDIR
189     LOCALSTATEDIR
190     LIBDIR
191     INCLUDEDIR
192     OLDINCLUDEDIR
193     DATAROOTDIR
194     DATADIR
195     INFODIR
196     LOCALEDIR
197     MANDIR
198     DOCDIR
199     )
200   if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
201     set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
202   else()
203     set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
204   endif()
205 endforeach()