Merge topic 'GNUInstallDirs-special-prefixes'
8bcec4d2
Help: Add notes for topic 'GNUInstallDirs-special-prefixes'c8bd37ec
GNUInstallDirs: Add special cases for certain prefixes5f30f175
GNUInstallDirs: Add test cases
This commit is contained in:
commit
41cd8547c4
|
@ -0,0 +1,9 @@
|
|||
GNUInstallDirs-special-prefixes
|
||||
-------------------------------
|
||||
|
||||
* The :module:`GNUInstallDirs` module learned special default values
|
||||
for certain installation prefixes according to the `GNU Coding
|
||||
Standards`_ and the `Filesystem Hierarchy Standard`_.
|
||||
|
||||
.. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
|
||||
.. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
|
|
@ -9,6 +9,9 @@
|
|||
#
|
||||
# .. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
|
||||
#
|
||||
# Result Variables
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# Inclusion of this module defines the following variables:
|
||||
#
|
||||
# ``CMAKE_INSTALL_<dir>``
|
||||
|
@ -22,7 +25,8 @@
|
|||
# The absolute path generated from the corresponding ``CMAKE_INSTALL_<dir>``
|
||||
# value. If the value is not already an absolute path, an absolute path
|
||||
# is constructed typically by prepending the value of the
|
||||
# :variable:`CMAKE_INSTALL_PREFIX` variable.
|
||||
# :variable:`CMAKE_INSTALL_PREFIX` variable. However, there are some
|
||||
# `special cases`_ as documented below.
|
||||
#
|
||||
# where ``<dir>`` is one of:
|
||||
#
|
||||
|
@ -60,8 +64,44 @@
|
|||
#
|
||||
# If the includer does not define a value the above-shown default will be
|
||||
# used and the value will appear in the cache for editing by the user.
|
||||
#
|
||||
# Special Cases
|
||||
# ^^^^^^^^^^^^^
|
||||
#
|
||||
# The following values of :variable:`CMAKE_INSTALL_PREFIX` are special:
|
||||
#
|
||||
# ``/``
|
||||
#
|
||||
# For ``<dir>`` other than the ``SYSCONFDIR`` and ``LOCALSTATEDIR``,
|
||||
# the value of ``CMAKE_INSTALL_<dir>`` is prefixed with ``usr/`` if
|
||||
# it is not user-specified as an absolute path. For example, the
|
||||
# ``INCLUDEDIR`` value ``include`` becomes ``usr/include``.
|
||||
# This is required by the `GNU Coding Standards`_, which state:
|
||||
#
|
||||
# When building the complete GNU system, the prefix will be empty
|
||||
# and ``/usr`` will be a symbolic link to ``/``.
|
||||
#
|
||||
# ``/usr``
|
||||
#
|
||||
# For ``<dir>`` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the
|
||||
# ``CMAKE_INSTALL_FULL_<dir>`` is computed by prepending just ``/``
|
||||
# to the value of ``CMAKE_INSTALL_<dir>`` if it is not user-specified
|
||||
# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc``
|
||||
# becomes ``/etc``. This is required by the `GNU Coding Standards`_.
|
||||
#
|
||||
# ``/opt/...``
|
||||
#
|
||||
# For ``<dir>`` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the
|
||||
# ``CMAKE_INSTALL_FULL_<dir>`` is computed by *appending* the prefix
|
||||
# to the value of ``CMAKE_INSTALL_<dir>`` if it is not user-specified
|
||||
# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc``
|
||||
# becomes ``/etc/opt/...``. This is defined by the
|
||||
# `Filesystem Hierarchy Standard`_.
|
||||
#
|
||||
# .. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2015 Alex Turbov <i.zaufi@gmail.com>
|
||||
# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
|
||||
# Copyright 2011 Kitware, Inc.
|
||||
#
|
||||
|
@ -279,8 +319,35 @@ foreach(dir
|
|||
MANDIR
|
||||
DOCDIR
|
||||
)
|
||||
if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
|
||||
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
|
||||
if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_${dir}}")
|
||||
# Handle special cases:
|
||||
# - CMAKE_INSTALL_PREFIX == /
|
||||
# - CMAKE_INSTALL_PREFIX == /usr
|
||||
# - CMAKE_INSTALL_PREFIX == /opt/...
|
||||
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/")
|
||||
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
|
||||
set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
|
||||
else()
|
||||
if (NOT "${CMAKE_INSTALL_${dir}}" MATCHES "^usr/")
|
||||
set(CMAKE_INSTALL_${dir} "usr/${CMAKE_INSTALL_${dir}}")
|
||||
endif()
|
||||
set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
|
||||
endif()
|
||||
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
|
||||
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
|
||||
set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
|
||||
endif()
|
||||
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*")
|
||||
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
|
||||
set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}${CMAKE_INSTALL_PREFIX}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
|
||||
endif()
|
||||
|
|
|
@ -128,6 +128,7 @@ add_RunCMake_test(FPHSA)
|
|||
add_RunCMake_test(GeneratorExpression)
|
||||
add_RunCMake_test(GeneratorPlatform)
|
||||
add_RunCMake_test(GeneratorToolset)
|
||||
add_RunCMake_test(GNUInstallDirs)
|
||||
add_RunCMake_test(TargetPropertyGeneratorExpressions)
|
||||
add_RunCMake_test(Languages)
|
||||
add_RunCMake_test(ObjectLibrary)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
cmake_minimum_required(VERSION 3.3)
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(${RunCMake_TEST}.cmake)
|
|
@ -0,0 +1,28 @@
|
|||
set(CMAKE_SIZEOF_VOID_P 8)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "arch")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
set(CMAKE_SYSTEM_NAME "OpenBSD-Fake")
|
||||
endif()
|
||||
include(GNUInstallDirs)
|
||||
set(dirs
|
||||
BINDIR
|
||||
DATADIR
|
||||
DATAROOTDIR
|
||||
DOCDIR
|
||||
INCLUDEDIR
|
||||
INFODIR
|
||||
LIBDIR
|
||||
LIBEXECDIR
|
||||
LOCALEDIR
|
||||
LOCALSTATEDIR
|
||||
MANDIR
|
||||
SBINDIR
|
||||
SHAREDSTATEDIR
|
||||
SYSCONFDIR
|
||||
)
|
||||
foreach(dir ${dirs})
|
||||
message("CMAKE_INSTALL_${dir}='${CMAKE_INSTALL_${dir}}'")
|
||||
endforeach()
|
||||
foreach(dir ${dirs})
|
||||
message("CMAKE_INSTALL_FULL_${dir}='${CMAKE_INSTALL_FULL_${dir}}'")
|
||||
endforeach()
|
|
@ -0,0 +1,28 @@
|
|||
^CMAKE_INSTALL_BINDIR='bin'
|
||||
CMAKE_INSTALL_DATADIR='share'
|
||||
CMAKE_INSTALL_DATAROOTDIR='share'
|
||||
CMAKE_INSTALL_DOCDIR='share/doc/Opt'
|
||||
CMAKE_INSTALL_INCLUDEDIR='include'
|
||||
CMAKE_INSTALL_INFODIR='share/info'
|
||||
CMAKE_INSTALL_LIBDIR='(lib|lib64)'
|
||||
CMAKE_INSTALL_LIBEXECDIR='libexec'
|
||||
CMAKE_INSTALL_LOCALEDIR='share/locale'
|
||||
CMAKE_INSTALL_LOCALSTATEDIR='var'
|
||||
CMAKE_INSTALL_MANDIR='share/man'
|
||||
CMAKE_INSTALL_SBINDIR='sbin'
|
||||
CMAKE_INSTALL_SHAREDSTATEDIR='com'
|
||||
CMAKE_INSTALL_SYSCONFDIR='etc'
|
||||
CMAKE_INSTALL_FULL_BINDIR='/opt/Opt/bin'
|
||||
CMAKE_INSTALL_FULL_DATADIR='/opt/Opt/share'
|
||||
CMAKE_INSTALL_FULL_DATAROOTDIR='/opt/Opt/share'
|
||||
CMAKE_INSTALL_FULL_DOCDIR='/opt/Opt/share/doc/Opt'
|
||||
CMAKE_INSTALL_FULL_INCLUDEDIR='/opt/Opt/include'
|
||||
CMAKE_INSTALL_FULL_INFODIR='/opt/Opt/share/info'
|
||||
CMAKE_INSTALL_FULL_LIBDIR='/opt/Opt/(lib|lib64)'
|
||||
CMAKE_INSTALL_FULL_LIBEXECDIR='/opt/Opt/libexec'
|
||||
CMAKE_INSTALL_FULL_LOCALEDIR='/opt/Opt/share/locale'
|
||||
CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var/opt/Opt'
|
||||
CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/share/man'
|
||||
CMAKE_INSTALL_FULL_SBINDIR='/opt/Opt/sbin'
|
||||
CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/opt/Opt/com'
|
||||
CMAKE_INSTALL_FULL_SYSCONFDIR='/etc/opt/Opt'$
|
|
@ -0,0 +1,2 @@
|
|||
set(CMAKE_INSTALL_PREFIX "/opt/${PROJECT_NAME}")
|
||||
include(Common.cmake)
|
|
@ -0,0 +1,28 @@
|
|||
^CMAKE_INSTALL_BINDIR='usr/bin'
|
||||
CMAKE_INSTALL_DATADIR='usr/share'
|
||||
CMAKE_INSTALL_DATAROOTDIR='usr/share'
|
||||
CMAKE_INSTALL_DOCDIR='usr/share/doc/Root'
|
||||
CMAKE_INSTALL_INCLUDEDIR='usr/include'
|
||||
CMAKE_INSTALL_INFODIR='usr/share/info'
|
||||
CMAKE_INSTALL_LIBDIR='usr/(lib|lib64)'
|
||||
CMAKE_INSTALL_LIBEXECDIR='usr/libexec'
|
||||
CMAKE_INSTALL_LOCALEDIR='usr/share/locale'
|
||||
CMAKE_INSTALL_LOCALSTATEDIR='var'
|
||||
CMAKE_INSTALL_MANDIR='usr/share/man'
|
||||
CMAKE_INSTALL_SBINDIR='usr/sbin'
|
||||
CMAKE_INSTALL_SHAREDSTATEDIR='usr/com'
|
||||
CMAKE_INSTALL_SYSCONFDIR='etc'
|
||||
CMAKE_INSTALL_FULL_BINDIR='/usr/bin'
|
||||
CMAKE_INSTALL_FULL_DATADIR='/usr/share'
|
||||
CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share'
|
||||
CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Root'
|
||||
CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include'
|
||||
CMAKE_INSTALL_FULL_INFODIR='/usr/share/info'
|
||||
CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64)'
|
||||
CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec'
|
||||
CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale'
|
||||
CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var'
|
||||
CMAKE_INSTALL_FULL_MANDIR='/usr/share/man'
|
||||
CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin'
|
||||
CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com'
|
||||
CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$
|
|
@ -0,0 +1,2 @@
|
|||
set(CMAKE_INSTALL_PREFIX "/")
|
||||
include(Common.cmake)
|
|
@ -0,0 +1,6 @@
|
|||
include(RunCMake)
|
||||
|
||||
run_cmake(Opt)
|
||||
run_cmake(Root)
|
||||
run_cmake(Usr)
|
||||
run_cmake(UsrLocal)
|
|
@ -0,0 +1,28 @@
|
|||
^CMAKE_INSTALL_BINDIR='bin'
|
||||
CMAKE_INSTALL_DATADIR='share'
|
||||
CMAKE_INSTALL_DATAROOTDIR='share'
|
||||
CMAKE_INSTALL_DOCDIR='share/doc/Usr'
|
||||
CMAKE_INSTALL_INCLUDEDIR='include'
|
||||
CMAKE_INSTALL_INFODIR='share/info'
|
||||
CMAKE_INSTALL_LIBDIR='(lib|lib64|lib/arch)'
|
||||
CMAKE_INSTALL_LIBEXECDIR='libexec'
|
||||
CMAKE_INSTALL_LOCALEDIR='share/locale'
|
||||
CMAKE_INSTALL_LOCALSTATEDIR='var'
|
||||
CMAKE_INSTALL_MANDIR='share/man'
|
||||
CMAKE_INSTALL_SBINDIR='sbin'
|
||||
CMAKE_INSTALL_SHAREDSTATEDIR='com'
|
||||
CMAKE_INSTALL_SYSCONFDIR='etc'
|
||||
CMAKE_INSTALL_FULL_BINDIR='/usr/bin'
|
||||
CMAKE_INSTALL_FULL_DATADIR='/usr/share'
|
||||
CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share'
|
||||
CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Usr'
|
||||
CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include'
|
||||
CMAKE_INSTALL_FULL_INFODIR='/usr/share/info'
|
||||
CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64|lib/arch)'
|
||||
CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec'
|
||||
CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale'
|
||||
CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var'
|
||||
CMAKE_INSTALL_FULL_MANDIR='/usr/share/man'
|
||||
CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin'
|
||||
CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com'
|
||||
CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$
|
|
@ -0,0 +1,2 @@
|
|||
set(CMAKE_INSTALL_PREFIX "/usr")
|
||||
include(Common.cmake)
|
|
@ -0,0 +1,28 @@
|
|||
^CMAKE_INSTALL_BINDIR='bin'
|
||||
CMAKE_INSTALL_DATADIR='share'
|
||||
CMAKE_INSTALL_DATAROOTDIR='share'
|
||||
CMAKE_INSTALL_DOCDIR='share/doc/UsrLocal'
|
||||
CMAKE_INSTALL_INCLUDEDIR='include'
|
||||
CMAKE_INSTALL_INFODIR='share/info'
|
||||
CMAKE_INSTALL_LIBDIR='(lib|lib64)'
|
||||
CMAKE_INSTALL_LIBEXECDIR='libexec'
|
||||
CMAKE_INSTALL_LOCALEDIR='share/locale'
|
||||
CMAKE_INSTALL_LOCALSTATEDIR='var'
|
||||
CMAKE_INSTALL_MANDIR='share/man'
|
||||
CMAKE_INSTALL_SBINDIR='sbin'
|
||||
CMAKE_INSTALL_SHAREDSTATEDIR='com'
|
||||
CMAKE_INSTALL_SYSCONFDIR='etc'
|
||||
CMAKE_INSTALL_FULL_BINDIR='/usr/local/bin'
|
||||
CMAKE_INSTALL_FULL_DATADIR='/usr/local/share'
|
||||
CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/local/share'
|
||||
CMAKE_INSTALL_FULL_DOCDIR='/usr/local/share/doc/UsrLocal'
|
||||
CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/local/include'
|
||||
CMAKE_INSTALL_FULL_INFODIR='/usr/local/share/info'
|
||||
CMAKE_INSTALL_FULL_LIBDIR='/usr/local/(lib|lib64)'
|
||||
CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec'
|
||||
CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale'
|
||||
CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var'
|
||||
CMAKE_INSTALL_FULL_MANDIR='/usr/local/share/man'
|
||||
CMAKE_INSTALL_FULL_SBINDIR='/usr/local/sbin'
|
||||
CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/local/com'
|
||||
CMAKE_INSTALL_FULL_SYSCONFDIR='/usr/local/etc'$
|
|
@ -0,0 +1,2 @@
|
|||
set(CMAKE_INSTALL_PREFIX "/usr/local")
|
||||
include(Common.cmake)
|
Loading…
Reference in New Issue