5 # Define GNU standard installation directories
7 # Provides install directory variables as defined for GNU software:
11 # http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
13 # Inclusion of this module defines the following variables:
17 # CMAKE_INSTALL_<dir> - destination for files of a given type
18 # CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
20 # where <dir> is one of:
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)
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.
48 #=============================================================================
49 # Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
50 # Copyright 2011 Kitware, Inc.
52 # Distributed under the OSI-approved BSD License (the "License");
53 # see accompanying file Copyright.txt for details.
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.)
62 # Installation directories
64 if(NOT DEFINED CMAKE_INSTALL_BINDIR)
65 set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
68 if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
69 set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
72 if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
73 set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
76 if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
77 set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
80 if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
81 set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
84 if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
85 set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
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}")
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.")
110 if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
111 set(_LIBDIR_DEFAULT "lib64")
116 set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
119 if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
120 set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
123 if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
124 set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
127 if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
128 set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
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.
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}")
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")
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")
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")
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}")
161 #-----------------------------------------------------------------------------
165 CMAKE_INSTALL_SBINDIR
166 CMAKE_INSTALL_LIBEXECDIR
167 CMAKE_INSTALL_SYSCONFDIR
168 CMAKE_INSTALL_SHAREDSTATEDIR
169 CMAKE_INSTALL_LOCALSTATEDIR
171 CMAKE_INSTALL_INCLUDEDIR
172 CMAKE_INSTALL_OLDINCLUDEDIR
173 CMAKE_INSTALL_DATAROOTDIR
174 CMAKE_INSTALL_DATADIR
175 CMAKE_INSTALL_INFODIR
176 CMAKE_INSTALL_LOCALEDIR
200 if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
201 set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
203 set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")