summaryrefslogtreecommitdiff
path: root/Modules/GNUInstallDirs.cmake
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2021-11-19 11:02:21 +0100
committerBrad King <brad.king@kitware.com>2021-11-19 09:40:06 -0500
commitdd9584b352169f8050bd3b64caf3470b81ffafc9 (patch)
tree41cbb5b4c274732d19011a25d0664c7b3c06c903 /Modules/GNUInstallDirs.cmake
parent7d1cb6496e5fbe5ed9668e95141ade3514b52c93 (diff)
downloadcmake-dd9584b352169f8050bd3b64caf3470b81ffafc9.tar.gz
GNUInstallDirs: Apply Debian multiarch LIBDIR to more prefixes
On typical Debian amd64 system (bullseye), multiarch is setup as: ``` % cat /etc/ld.so.conf.d/x86_64-linux-gnu.conf /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu ``` Where: ``` % apt-cache policy libc6:amd64 libc6: Installed: 2.31-13+deb11u2 Candidate: 2.31-13+deb11u2 Version table: *** 2.31-13+deb11u2 500 500 http://deb.debian.org/debian bullseye/main amd64 Packages 100 /var/lib/dpkg/status ``` Update GNUInstallDirs to support all three cases `/`, `/usr/` and `/usr/local/`. Fixes: #19698
Diffstat (limited to 'Modules/GNUInstallDirs.cmake')
-rw-r--r--Modules/GNUInstallDirs.cmake10
1 files changed, 7 insertions, 3 deletions
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index 6ca424ad5d..489c233197 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -52,8 +52,10 @@ where ``<dir>`` is one of:
.. versionadded:: 3.9
run-time variable data (``LOCALSTATEDIR/run``)
``LIBDIR``
- object code libraries (``lib`` or ``lib64``
- or ``lib/<multiarch-tuple>`` on Debian)
+ object code libraries (``lib`` or ``lib64``)
+
+ On Debian, this may be ``lib/<multiarch-tuple>`` when
+ :variable:`CMAKE_INSTALL_PREFIX` is ``/``, ``/usr``, or ``/usr/local``.
``INCLUDEDIR``
C header files (``include``)
``OLDINCLUDEDIR``
@@ -269,7 +271,9 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set
if(__system_type_for_install STREQUAL "debian")
if(CMAKE_LIBRARY_ARCHITECTURE)
- if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
+ if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/"
+ OR "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$"
+ OR "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/local/?$")
set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
endif()
if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX