Files
CMake/Auxiliary/bash-completion/CMakeLists.txt
Eli Schwartz 2642f432ef 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
2020-03-31 12:01:40 -04:00

17 lines
932 B
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_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})