summaryrefslogtreecommitdiff
path: root/Modules/GNUInstallDirs.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-06-02 09:58:32 -0400
committerBrad King <brad.king@kitware.com>2022-06-02 10:04:35 -0400
commit8de3983b4cd6d25fb056419c34cfcb7e050fdba6 (patch)
tree8656e91963cbdfb59629f3baad30d18591cdee16 /Modules/GNUInstallDirs.cmake
parente6c4af42934da54c3bab44778c796af1a45e0032 (diff)
downloadcmake-8de3983b4cd6d25fb056419c34cfcb7e050fdba6.tar.gz
GNUInstallDirs: Do not treat /opt/homebrew as under /opt
Fixes: #23579
Diffstat (limited to 'Modules/GNUInstallDirs.cmake')
-rw-r--r--Modules/GNUInstallDirs.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index bd72901941..97968549dc 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -112,6 +112,8 @@ The following values of :variable:`CMAKE_INSTALL_PREFIX` are special:
For example, the ``SYSCONFDIR`` value ``etc`` becomes ``/etc/opt/...``.
This is defined by the `Filesystem Hierarchy Standard`_.
+ This behavior does not apply to paths under ``/opt/homebrew/...``.
+
.. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
Macros
@@ -400,7 +402,7 @@ macro(GNUInstallDirs_get_absolute_install_dir absvar var)
else()
set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
- elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*")
+ elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/" AND NOT "${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/homebrew/")
if("${GGAID_dir}" STREQUAL "SYSCONFDIR" OR "${GGAID_dir}" STREQUAL "LOCALSTATEDIR" OR "${GGAID_dir}" STREQUAL "RUNSTATEDIR")
set(${absvar} "/${${var}}${CMAKE_INSTALL_PREFIX}")
else()