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