File: OpmBashCompletion.cmake

package info (click to toggle)
opm-common 2022.10%2Bds-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,468 kB
  • sloc: cpp: 164,554; python: 2,872; sh: 216; xml: 174; ansic: 149; pascal: 136; makefile: 12
file content (16 lines) | stat: -rw-r--r-- 808 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Installs bash tab completion for a product
macro(opm_add_bash_completion binary)
  option(USE_BASH_COMPLETIONS_DIR
    "Whether to use the new bash completion dir (/usr/share/bash-completion/completions) with load on demand"
    OFF)
  if(USE_BASH_COMPLETIONS_DIR)
    set(_BASH_COMPLETION_FILE ${binary})
    set(_BASH_COMPLETION_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}/bash-completion/completions)
  else()
    set(_BASH_COMPLETION_FILE ${binary}_bash_completion.sh)
    set(_BASH_COMPLETION_INSTALL_DIR ${CMAKE_INSTALL_SYSCONFDIR}/bash_completion.d)
  endif()
  set(PRODUCT ${binary})
  configure_file(${OPM_MACROS_ROOT}/etc/opm_bash_completion.sh.in ${_BASH_COMPLETION_FILE} @ONLY)
  install(FILES ${PROJECT_BINARY_DIR}/${_BASH_COMPLETION_FILE} DESTINATION ${_BASH_COMPLETION_INSTALL_DIR})
endmacro()