ClickHouse/programs/bash-completion/completions/CMakeLists.txt
Azat Khuzhin 4c043301e6 Avoid ignoring errors of execute_process() (set COMMAND_ERROR_IS_FATAL=ANY)
This will fix with issues like this [1]:

    Aug 12 09:58:44 '/usr/bin/cmake' '--build' '/build/build_docker/native' '--target' 'pre_compressor'
    Aug 12 09:58:44 sccache: error: Server startup failed: cache storage failed to read: Unexpected (temporary) at stat
    Aug 12 09:58:45 ninja: build stopped: subcommand failed.
    Aug 12 09:58:45 -- Configuring done (77.7s)
    Aug 12 09:58:47 -- Generating done (1.8s)
    Aug 12 09:58:47 -- Build files have been written to: /build/build_docker

So as you can see even if ninja fails it still wrote build files, while
it should fail.

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/64955/0af41e32a5822d25ac3760f1ebb2313557474701/builds/report.html
  [2]: 0af41e32a5/binary_darwin_aarch64/build_log.log

Note, COMMAND_ERROR_IS_FATAL is 3.19+, and the requirement for now is
3.20

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2024-08-13 10:35:54 +02:00

30 lines
838 B
CMake

macro(configure_bash_completion)
set(out "/usr/share/bash-completion/completions")
find_program(pkg-config PKG_CONFIG_BIN)
if (PKG_CONFIG_BIN)
execute_process(
COMMAND ${PKG_CONFIG_BIN} --variable=completionsdir bash-completion
OUTPUT_VARIABLE ${out}
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
endif()
string(REPLACE /usr "${CMAKE_INSTALL_PREFIX}" out "${out}")
message(STATUS "bash_completion will be written to ${out}")
endmacro()
configure_bash_completion()
foreach (name
# set of functions
clickhouse-bootstrap
# binaries that accept settings as command line argument
clickhouse-client
clickhouse-local
clickhouse-benchmark
clickhouse
)
install(FILES ${name} DESTINATION ${out})
endforeach()