Merge topic 'doc-maint-git'
[kiteware-cmake.git] / Auxiliary / bash-completion / CMakeLists.txt
blob93b6ffd0e3c72b4afb3629e8239bacf394cf9de0
1 # We need to integrate into the system install, or this will silently fail to
2 # accomplish anything at all, and packagers won't even know it exists. Use the
3 # `<sharedir>/bash-completion/completions/` hierarchy by default, rooted in
4 # CMake's XDGDATA_DIR definition of the sharedir. This works with installation
5 # to `/usr` or `/usr/local` (or any prefix which bash-completion is configured
6 # with) as well as a simple installation by a local user into their home
7 # directory *if* the prefix is `$HOME/.local` since `.local/share/` is part of
8 # the bash-completion search path too.
9 # For more complex installations, packagers can set CMake_INSTALL_BASH_COMP_DIR
10 # to another system location.
12 if(NOT CMake_INSTALL_BASH_COMP_DIR)
13   if(CMAKE_BASH_COMP_DIR)
14     # Honor previous customization option.
15     set(CMake_INSTALL_BASH_COMP_DIR "${CMAKE_BASH_COMP_DIR}")
16   else()
17     # Default.
18     set(CMake_INSTALL_BASH_COMP_DIR ${CMAKE_XDGDATA_DIR}/bash-completion/completions)
19   endif()
20 endif()
21 install(FILES cmake cpack ctest DESTINATION ${CMake_INSTALL_BASH_COMP_DIR})