CMakeLists.txt 1.0 KB

123456789101112131415161718192021
  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.
  11. if(NOT CMake_INSTALL_BASH_COMP_DIR)
  12. if(CMAKE_BASH_COMP_DIR)
  13. # Honor previous customization option.
  14. set(CMake_INSTALL_BASH_COMP_DIR "${CMAKE_BASH_COMP_DIR}")
  15. else()
  16. # Default.
  17. set(CMake_INSTALL_BASH_COMP_DIR ${CMAKE_XDGDATA_DIR}/bash-completion/completions)
  18. endif()
  19. endif()
  20. install(FILES cmake cpack ctest DESTINATION ${CMake_INSTALL_BASH_COMP_DIR})