summaryrefslogtreecommitdiffstats
path: root/Auxiliary
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2020-03-31 03:07:37 (GMT)
committerEli Schwartz <eschwartz@archlinux.org>2020-03-31 16:01:40 (GMT)
commit2642f432ef05d083da66c0b24cd10d655f951186 (patch)
tree8c31660b905adcdc51b56e127ebb8105abe8c1a0 /Auxiliary
parent529d7291b40e8b4c09e3952d6992cafcee979f8c (diff)
downloadCMake-2642f432ef05d083da66c0b24cd10d655f951186.zip
CMake-2642f432ef05d083da66c0b24cd10d655f951186.tar.gz
CMake-2642f432ef05d083da66c0b24cd10d655f951186.tar.bz2
Aux: Install editor and bash files to more natural locations
The vim, emacs, and bash support files are not internal CMake resources and so do not belong under `CMAKE_DATA_DIR`. Move them over to proper places under the `CMAKE_XDGDATA_DIR` as we do already for cmake-gui desktop files and `cmake.m4`. Fixes: #20522
Diffstat (limited to 'Auxiliary')
-rw-r--r--Auxiliary/CMakeLists.txt4
-rw-r--r--Auxiliary/bash-completion/CMakeLists.txt24
2 files changed, 18 insertions, 10 deletions
diff --git a/Auxiliary/CMakeLists.txt b/Auxiliary/CMakeLists.txt
index 53cf2c5..a833c79 100644
--- a/Auxiliary/CMakeLists.txt
+++ b/Auxiliary/CMakeLists.txt
@@ -1,4 +1,4 @@
-install(DIRECTORY vim/indent vim/syntax DESTINATION ${CMAKE_DATA_DIR}/editors/vim)
-install(FILES cmake-mode.el DESTINATION ${CMAKE_DATA_DIR}/editors/emacs)
+install(DIRECTORY vim/indent vim/syntax DESTINATION ${CMAKE_XDGDATA_DIR}/vim/vimfiles)
+install(FILES cmake-mode.el DESTINATION ${CMAKE_XDGDATA_DIR}/emacs/site-lisp)
install(FILES cmake.m4 DESTINATION ${CMAKE_XDGDATA_DIR}/aclocal)
add_subdirectory (bash-completion)
diff --git a/Auxiliary/bash-completion/CMakeLists.txt b/Auxiliary/bash-completion/CMakeLists.txt
index c0a8899..06d22c2 100644
--- a/Auxiliary/bash-completion/CMakeLists.txt
+++ b/Auxiliary/bash-completion/CMakeLists.txt
@@ -1,8 +1,16 @@
-# Always install completion file in local dir
-# in order to be sure to always be able to install
-# in a local user directory rooted in a single directory.
-# packager should either patch that out or
-# add symlinks to the files in appropriate places
-# /etc/bash_completion.d/
-# DATADIR/completions (may be /usr/share/<package>/completions
-install(FILES cmake cpack ctest DESTINATION ${CMAKE_DATA_DIR}/completions)
+# We need to integrate into the system install, or this will silently fail to
+# accomplish anything at all, and packagers won't even know it exists. Use the
+# `<sharedir>/bash-completion/completions/` hierarchy by default, rooted in
+# CMake's XDGDATA_DIR definition of the sharedir. This works with installation
+# to `/usr` or `/usr/local` (or any prefix which bash-completion is configured
+# with) as well as a simple installation by a local user into their home
+# directory *if* the prefix is `$HOME/.local` since `.local/share/` is part of
+# the bash-completion search path too.
+# For more complex installations, packagers can set CMAKE_BASH_COMP_DIR to
+# another system location.
+
+set(CMAKE_BASH_COMP_DIR_DEFAULT ${CMAKE_XDGDATA_DIR}/bash-completion/completions)
+if (NOT CMAKE_BASH_COMP_DIR)
+ set(CMAKE_BASH_COMP_DIR "${CMAKE_BASH_COMP_DIR_DEFAULT}")
+endif()
+install(FILES cmake cpack ctest DESTINATION ${CMAKE_BASH_COMP_DIR})