1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-05-09 06:42:18 +08:00
Brad King 83bc79e232 Auxiliary: Add options to control Vim and Emacs file installation
Since commit 2642f432ef (Aux: Install editor and bash files to more
natural locations, 2020-03-30, v3.18.0-rc1~429^2) these files are
installed by default into locations that are not CMake-specific but may
be distro-specific.  Add options for packagers to control these
locations.

Also rename the `CMAKE_BASH_COMP_DIR` option to follow our conventions.

Fixes: #20993
2020-07-21 08:34:30 -04:00

22 lines
1.0 KiB
CMake

# 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_INSTALL_BASH_COMP_DIR
# to another system location.
if(NOT CMake_INSTALL_BASH_COMP_DIR)
if(CMAKE_BASH_COMP_DIR)
# Honor previous customization option.
set(CMake_INSTALL_BASH_COMP_DIR "${CMAKE_BASH_COMP_DIR}")
else()
# Default.
set(CMake_INSTALL_BASH_COMP_DIR ${CMAKE_XDGDATA_DIR}/bash-completion/completions)
endif()
endif()
install(FILES cmake cpack ctest DESTINATION ${CMake_INSTALL_BASH_COMP_DIR})