This applies a similar modernization as was done in 1ff41ba26e
(Auxiliary: bash-completion: use _comp_initialize, 2024-06-02)
for the cmake executable. The _init_completion function was
deprecated upstream in bash-completion 2.12.
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
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
In case of long '<command> <args...>' the description text is wrapped
and indented on the next line.
Avoid taking these lines into account by explicitly requiring the third
character to be a non-space.
With the current version of homebrew one gets:
bash: _init_completion: command not found
Avoid this by initializing manually when the function is not defined.