[Cmake-commits] CMake branch, next, updated. v3.6.1-1850-gcd86f89
Brad King
brad.king at kitware.com
Wed Sep 7 09:41:28 EDT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via cd86f89237cbe29cc8eadb8e608e2c613a974f8b (commit)
via 17a24dc3b9ed5e09b5382deb97343496af902ec0 (commit)
from 930d0f6c8cf7ad0a6ffea015d31491589600937e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cd86f89237cbe29cc8eadb8e608e2c613a974f8b
commit cd86f89237cbe29cc8eadb8e608e2c613a974f8b
Merge: 930d0f6 17a24dc
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 7 09:41:27 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Sep 7 09:41:27 2016 -0400
Merge topic 'GNUInstallDirs-function' into next
17a24dc3 GNUInstallDirs: Add macro to expose internal logic publicly
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=17a24dc3b9ed5e09b5382deb97343496af902ec0
commit 17a24dc3b9ed5e09b5382deb97343496af902ec0
Author: Roger Leigh <rleigh at codelibre.net>
AuthorDate: Sun Aug 28 18:19:02 2016 +0100
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 7 09:40:41 2016 -0400
GNUInstallDirs: Add macro to expose internal logic publicly
diff --git a/Help/release/dev/GNUInstallDirs-function.rst b/Help/release/dev/GNUInstallDirs-function.rst
new file mode 100644
index 0000000..65ea7fb
--- /dev/null
+++ b/Help/release/dev/GNUInstallDirs-function.rst
@@ -0,0 +1,5 @@
+GNUInstallDirs-function
+-----------------------
+
+* The :module:`GNUInstallDirs` module gained a new
+ :command:`GNUInstallDirs_get_absolute_install_dir` command.
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index b42084e..0c80b8a 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -99,6 +99,23 @@
# `Filesystem Hierarchy Standard`_.
#
# .. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
+#
+# Macros
+# ^^^^^^
+#
+# .. command:: GNUInstallDirs_get_absolute_install_dir
+#
+# ::
+#
+# GNUInstallDirs_get_absolute_install_dir(absvar var)
+#
+# Set the given variable ``absvar`` to the absolute path contained
+# within the variable ``var``. This is to allow the computation of an
+# absolute path, accounting for all the special cases documented
+# above. While this macro is used to compute the various
+# ``CMAKE_INSTALL_FULL_<dir>`` variables, it is exposed publicly to
+# allow users who create additional path variables to also compute
+# absolute paths where necessary, using the same logic.
#=============================================================================
# Copyright 2015 Alex Turbov <i.zaufi at gmail.com>
@@ -300,55 +317,59 @@ mark_as_advanced(
CMAKE_INSTALL_DOCDIR
)
-# Result directories
-#
-foreach(dir
- BINDIR
- SBINDIR
- LIBEXECDIR
- SYSCONFDIR
- SHAREDSTATEDIR
- LOCALSTATEDIR
- LIBDIR
- INCLUDEDIR
- OLDINCLUDEDIR
- DATAROOTDIR
- DATADIR
- INFODIR
- LOCALEDIR
- MANDIR
- DOCDIR
- )
- if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_${dir}}")
+macro(GNUInstallDirs_get_absolute_install_dir absvar var)
+ if(NOT IS_ABSOLUTE "${${var}}")
# 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}}")
+ set(${absvar} "/${${var}}")
else()
- if (NOT "${CMAKE_INSTALL_${dir}}" MATCHES "^usr/")
- set(CMAKE_INSTALL_${dir} "usr/${CMAKE_INSTALL_${dir}}")
+ if (NOT "${${var}}" MATCHES "^usr/")
+ set(${var} "usr/${${var}}")
endif()
- set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "/${${var}}")
endif()
elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
- set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "/${${var}}")
else()
- set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
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}")
+ set(${absvar} "/${${var}}${CMAKE_INSTALL_PREFIX}")
else()
- set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
else()
- set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
else()
- set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
+ set(${absvar} "${${var}}")
endif()
+endmacro()
+
+# Result directories
+#
+foreach(dir
+ BINDIR
+ SBINDIR
+ LIBEXECDIR
+ SYSCONFDIR
+ SHAREDSTATEDIR
+ LOCALSTATEDIR
+ LIBDIR
+ INCLUDEDIR
+ OLDINCLUDEDIR
+ DATAROOTDIR
+ DATADIR
+ INFODIR
+ LOCALEDIR
+ MANDIR
+ DOCDIR
+ )
+ GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir})
endforeach()
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list