mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 10:52:30 +00:00
1a7727a254
A simple HelloWorld program with zero includes except iostream triggers a build of ca. 2000 source files. The reason is that ClickHouse's top-level CMakeLists.txt overrides "add_executable()" to link all binaries against "clickhouse_new_delete". This links against "clickhouse_common_io", which in turn has lots of 3rd party library dependencies ... Without linking "clickhouse_new_delete", the number of compiled files for "HelloWorld" goes down to ca. 70. As an example, the self-extracting-executable needs none of its current dependencies but other programs may also benefit. In order to restore access to the original "add_executable()", the overriding version is now prefixed. There is precedence for a "clickhouse_" prefix (as opposed to "ch_"), for example "clickhouse_split_debug_symbols". In general prefixing makes sense also because overriding CMake commands relies on undocumented behavior and is considered not-so-great practice (*). (*) https://crascit.com/2018/09/14/do-not-redefine-cmake-commands/
17 lines
927 B
CMake
17 lines
927 B
CMake
clickhouse_add_executable (merge_selector merge_selector.cpp)
|
|
target_link_libraries (merge_selector PRIVATE dbms)
|
|
|
|
clickhouse_add_executable (merge_selector2 merge_selector2.cpp)
|
|
target_link_libraries (merge_selector2 PRIVATE dbms)
|
|
|
|
clickhouse_add_executable (get_current_inserts_in_replicated get_current_inserts_in_replicated.cpp)
|
|
target_link_libraries (get_current_inserts_in_replicated PRIVATE dbms clickhouse_common_config clickhouse_common_zookeeper string_utils)
|
|
|
|
clickhouse_add_executable (get_abandonable_lock_in_all_partitions get_abandonable_lock_in_all_partitions.cpp)
|
|
target_link_libraries (get_abandonable_lock_in_all_partitions PRIVATE dbms clickhouse_common_config clickhouse_common_zookeeper)
|
|
|
|
if (TARGET ch_contrib::hdfs)
|
|
clickhouse_add_executable (async_read_buffer_from_hdfs async_read_buffer_from_hdfs.cpp)
|
|
target_link_libraries (async_read_buffer_from_hdfs PRIVATE dbms ch_contrib::hdfs)
|
|
endif ()
|