rewrote code from bash to python

This commit is contained in:
myrrc 2020-09-15 22:32:42 +03:00
parent 3319933dc9
commit bd1a7c69ba
6 changed files with 320 additions and 276 deletions

View File

@ -29,9 +29,8 @@ endforeach()
project(ClickHouse)
option(FAIL_ON_UNSUPPORTED_OPTIONS_COMBINATION
"Stop/Fail CMake configuration if some ENABLE_XXX option is defined (either ON or OFF) but is not possible to satisfy"
ON
)
"Stop/Fail CMake configuration if some ENABLE_XXX option is defined (either ON or OFF) but is not possible to satisfy" ON)
if(FAIL_ON_UNSUPPORTED_OPTIONS_COMBINATION)
set(RECONFIGURE_MESSAGE_LEVEL FATAL_ERROR)
else()
@ -58,7 +57,11 @@ set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Generate debug library name with a pos
# For more info see https://cmake.org/cmake/help/latest/prop_gbl/USE_FOLDERS.html
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
option(ENABLE_IPO "Enable full link time optimization (it's usually impractical; see also ENABLE_THINLTO)" OFF) # need cmake 3.9+
# Need cmake 3.9+
# Usually impractical.
# See also ENABLE_THINLTO
option(ENABLE_IPO "Enable full link time optimization")
if(ENABLE_IPO)
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
@ -90,6 +93,7 @@ string (TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
option (USE_STATIC_LIBRARIES "Set to FALSE to use shared libraries" ON)
option (MAKE_STATIC_LIBRARIES "Set to FALSE to make shared libraries" ${USE_STATIC_LIBRARIES})
if (NOT MAKE_STATIC_LIBRARIES)
option (SPLIT_SHARED_LIBRARIES "DEV ONLY. Keep all internal libs as separate .so for faster linking" OFF)
option (CLICKHOUSE_SPLIT_BINARY "Make several binaries instead one bundled (clickhouse-server, clickhouse-client, ... )" OFF)

123
cmake_files_footer.md Normal file
View File

@ -0,0 +1,123 @@
## Developer's guide for adding new CMake options
### Don't be obvious. Be informative.
Bad:
```cmake
option (ENABLE_TESTS "Enables testing" OFF)
```
This description is quite useless as is neither gives the viewer any additional information nor explains the option
purpose. If the option's name is quite self-descriptive, prefer the empty description.
Better:
```cmake
option(ENABLE_TESTS OFF)
```
If the option's purpose can't be guessed by its name, or the purpose guess may be misleading, leave a comment above
the `option()` line and explain what it does. The best way would be linking the docs page (if it exists).
The comment is parsed into a separate column (see below).
Even better (default off value is omitted):
```cmake
# Adds the ability to test ClickHouse using Google.Test (would produce another target unit_tests_dbms).
# see tests/CMakeLists.txt for implementation detail.
option(ENABLE_GTEST_TESTS)
```
### If the option's state could produce unwanted (or unusual) result, explicitly warn the user.
Suppose you have an option that may strip debug symbols from the ClickHouse's part.
This can speed up the linking process, but produces a binary that cannot be debugged.
In that case, prefer explicitly raising a warning telling the developer that he may be doing something wrong.
Also, such options should be disabled if applies.
Bad:
```cmake
option(STRIP_DEBUG_SYMBOLS_FUNCTIONS
"Do not generate debugger info for ClickHouse functions.
${STRIP_DSF_DEFAULT})
if (STRIP_DEBUG_SYMBOLS_FUNCTIONS)
target_compile_options(clickhouse_functions PRIVATE "-g0")
endif()
```
Better:
```cmake
# Provides faster linking and lower binary size.
# Tradeoff is the inability to debug some source files with e.g. gdb
# (empty stack frames and no local variables)."
option(STRIP_DEBUG_SYMBOLS_FUNCTIONS
"Do not generate debugger info for ClickHouse functions."
${STRIP_DSF_DEFAULT})
if (STRIP_DEBUG_SYMBOLS_FUNCTIONS)
message(WARNING "Not generating debugger info for ClickHouse functions")
target_compile_options(clickhouse_functions PRIVATE "-g0")
endif()
```
### In the option's description, explain WHAT the option does rather than WHY it does something.
The WHY explanation should be placed in the comment.
You may find that the option's name is self-descriptive.
Bad:
```cmake
option(ENABLE_THINLTO "Enable Thin LTO. Only applicable for clang. It's also suppressed when building with tests or sanitizers." ON)
```
Better:
```cmake
# Only applicable for clang.
# Turned off when building with tests or sanitizers.
option(ENABLE_THINLTO ON).
```
### Don't assume other developers know as much as you do.
In ClickHouse, there are many tools used that an ordinary developer may not know. If you are in doubt, give a link to
the tool's docs. It won't take much of your time.
Bad:
```cmake
option(ENABLE_THINLTO "Enable Thin LTO. Only applicable for clang. It's also suppressed when building with tests or sanitizers." ON)
```
Better (combined with the above hint):
```cmake
# https://clang.llvm.org/docs/ThinLTO.html
# Only applicable for clang.
# Turned off when building with tests or sanitizers.
option(ENABLE_THINLTO ON).
```
Other example, bad:
```cmake
option (USE_INCLUDE_WHAT_YOU_USE "Use 'include-what-you-use' tool" OFF)
```
Better:
```cmake
# https://github.com/include-what-you-use/include-what-you-use
option (USE_INCLUDE_WHAT_YOU_USE)
```
### Prefer consistent default values.
CMake allows you to pass a plethora of values representing boolean `true/false`, e.g. `1, ON, YES, ...`.
Prefer the `ON/OFF` values, if possible.

View File

@ -1,131 +1,14 @@
# CMake flags
# All about CMake in ClickHouse
## Developer's guide for adding new CMake options
### Don't be obvious. Be informative.
Bad:
```cmake
option (ENABLE_TESTS "Enables testing" OFF)
```
This description is quite useless as is neither gives the viewer any additional information nor explains the option
purpose. If the option's name is quite self-descriptive, prefer the empty description.
Better:
```cmake
option(ENABLE_TESTS OFF)
```
If the option's purpose can't be guessed by its name, or the purpose guess may be misleading, leave a comment above
the `option()` line and explain what it does. The best way would be linking the docs page (if it exists).
The comment is parsed into a separate column (see below).
Even better (default off value is omitted):
```cmake
# Adds the ability to test ClickHouse using Google.Test (would produce another target unit_tests_dbms).
# see tests/CMakeLists.txt for implementation detail.
option(ENABLE_GTEST_TESTS)
```
### If the option's state could produce unwanted (or unusual) result, explicitly warn the user.
Suppose you have an option that may strip debug symbols from the ClickHouse's part.
This can speed up the linking process, but produces a binary that cannot be debugged.
In that case, prefer explicitly raising a warning telling the developer that he may be doing something wrong.
Also, such options should be disabled if applies.
Bad:
```cmake
option(STRIP_DEBUG_SYMBOLS_FUNCTIONS
"Do not generate debugger info for ClickHouse functions.
${STRIP_DSF_DEFAULT})
if (STRIP_DEBUG_SYMBOLS_FUNCTIONS)
target_compile_options(clickhouse_functions PRIVATE "-g0")
endif()
```
Better:
```cmake
# Provides faster linking and lower binary size.
# Tradeoff is the inability to debug some source files with e.g. gdb
# (empty stack frames and no local variables)."
option(STRIP_DEBUG_SYMBOLS_FUNCTIONS
"Do not generate debugger info for ClickHouse functions."
${STRIP_DSF_DEFAULT})
if (STRIP_DEBUG_SYMBOLS_FUNCTIONS)
message(WARNING "Not generating debugger info for ClickHouse functions")
target_compile_options(clickhouse_functions PRIVATE "-g0")
endif()
```
### In the option's description, explain WHAT the option does rather than WHY it does something.
The WHY explanation should be placed in the comment.
You may find that the option's name is self-descriptive.
Bad:
```cmake
option(ENABLE_THINLTO "Enable Thin LTO. Only applicable for clang. It's also suppressed when building with tests or sanitizers." ON)
```
Better:
```cmake
# Only applicable for clang.
# Turned off when building with tests or sanitizers.
option(ENABLE_THINLTO ON).
```
### Don't assume other developers know as much as you do.
In ClickHouse, there are many tools used that an ordinary developer may not know. If you are in doubt, give a link to
the tool's docs. It won't take much of your time.
Bad:
```cmake
option(ENABLE_THINLTO "Enable Thin LTO. Only applicable for clang. It's also suppressed when building with tests or sanitizers." ON)
```
Better (combined with the above hint):
```cmake
# https://clang.llvm.org/docs/ThinLTO.html
# Only applicable for clang.
# Turned off when building with tests or sanitizers.
option(ENABLE_THINLTO ON).
```
Other example, bad:
```cmake
option (USE_INCLUDE_WHAT_YOU_USE "Use 'include-what-you-use' tool" OFF)
```
Better:
```cmake
# https://github.com/include-what-you-use/include-what-you-use
option (USE_INCLUDE_WHAT_YOU_USE)
```
### Prefer consistent default values.
CMake allows you to pass a plethora of values representing boolean `true/false`, e.g. `1, ON, YES, ...`.
Prefer the `ON/OFF` values, if possible.
## How ClickHouse uses CMake
TODO describe separate cmake files for contrib + arch-dependent ones + options finding.
## List of CMake flags
* This list is auto-generated by [this bash script](bash.sh).
* The flag name is a link to its position in the code.
* If an option's default valus is itself an option, it's also a link to its position in this list.
| Name | Default value | Description | Comment |
|------|---------------|-------------|---------|

View File

@ -1,5 +1,85 @@
# CMake flags
# All about CMake in ClickHouse
## How ClickHouse uses CMake
TODO describe separate cmake files for contrib + arch-dependent ones + options finding.
## List of CMake flags
* This list is auto-generated by [this bash script](bash.sh).
* The flag name is a link to its position in the code.
* If an option's default valus is itself an option, it's also a link to its position in this list.
| Name | Default value | Description | Comment |
|------|---------------|-------------|---------|
| <a name="add_gdb_index_for_gold"></a>(`ADD_GDB_INDEX_FOR_GOLD`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L181] | `0` | Set to add .gdb-index to resulting binaries for gold linker. NOOP if lld is used. | |
| <a name="arch_native"></a>(`ARCH_NATIVE`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L215] | `0` | Enable -march=native compiler flag | |
| <a name="clickhouse_split_binary"></a>(`CLICKHOUSE_SPLIT_BINARY`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L98] | `OFF` | Make several binaries instead one bundled (clickhouse-server, clickhouse-client, ... ) | |
| <a name="compiler_pipe"></a>(`COMPILER_PIPE`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L203] | `ON` | -pipe compiler option [less /tmp usage, more ram usage] | |
| <a name="enable_fuzzing"></a>(`ENABLE_FUZZING`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L113] | `OFF` | Enables fuzzing instrumentation | |
| <a name="enable_ipo"></a>(`ENABLE_IPO`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L62] | `OFF` | Enable full link time optimization | |
| <a name="enable_libraries"></a>(`ENABLE_LIBRARIES`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L308] | `ON` | Enable all libraries (Global default switch) | |
| <a name="enable_tests"></a>(`ENABLE_TESTS`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L145] | `ON` | Enables tests | |
| <a name="enable_thinlto"></a>(`ENABLE_THINLTO`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L61] | `ON` | Enable Thin LTO. Only applicable for clang. It's also suppressed when building with tests or sanitizers. | Need cmake 3.9+
Usually impractical.
See also ENABLE_THINLTO
|
| <a name="fail_on_unsupported_options_combination"></a>(`FAIL_ON_UNSUPPORTED_OPTIONS_COMBINATION`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L30] | `ON` | Stop/Fail CMake configuration if some ENABLE_XXX option is defined (either ON or OFF) but is not possible to satisfy | |
| <a name="glibc_compatibility"></a>(`GLIBC_COMPATIBILITY`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L148] | `ON` | Set to TRUE to enable compatibility with older glibc libraries. Only for x86_64, Linux. Implies ENABLE_FASTMEMCPY. | |
| <a name="make_static_libraries"></a>(`MAKE_STATIC_LIBRARIES`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L94] | (`USE_STATIC_LIBRARIES`)[#use_static_libraries] | Set to FALSE to make shared libraries | |
| <a name="split_shared_libraries"></a>(`SPLIT_SHARED_LIBRARIES`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L97] | `OFF` | DEV ONLY. Keep all internal libs as separate .so for faster linking | |
| <a name="unbundled"></a>(`UNBUNDLED`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L147] | `OFF` | Try find all libraries in system. We recommend to avoid this mode for production builds, because we cannot guarantee exact versions and variants of libraries your system has installed. This mode exists for enthusiastic developers who search for trouble. Also it is useful for maintainers of OS packages. | |
| <a name="use_include_what_you_use"></a>(`USE_INCLUDE_WHAT_YOU_USE`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L364] | `OFF` | Use 'include-what-you-use' tool | |
| <a name="use_static_libraries"></a>(`USE_STATIC_LIBRARIES`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L93] | `ON` | Set to FALSE to use shared libraries | |
| <a name="werror"></a>(`WERROR`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L319] | `OFF` | Enable -Werror compiler option | |
| <a name="werror"></a>(`WERROR`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L319] | `ON` | Enable -Werror compiler option | |
| <a name="with_coverage"></a>(`WITH_COVERAGE`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L117] | `0` | Build with coverage. | || <a name="weverything"></a>(`WEVERYTHING`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/warnings.cmake#L20] | `ON` | Enables -Weverything option with some exceptions. This is intended for exploration of new compiler warnings that may be found to be useful. Only makes sense for clang. | || <a name="parallel_compile_jobs"></a>(`PARALLEL_COMPILE_JOBS`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/limit_jobs.cmake#L8] | `""` | Define the maximum number of concurrent compilation jobs | |
| <a name="parallel_link_jobs"></a>(`PARALLEL_LINK_JOBS`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/limit_jobs.cmake#L21] | `""` | Define the maximum number of concurrent link jobs | || <a name="enable_clang_tidy"></a>(`ENABLE_CLANG_TIDY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/analysis.cmake#L2] | `OFF` | Use 'clang-tidy' static analyzer if present | || <a name="sanitize"></a>(`SANITIZE`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/sanitize.cmake#L0] | `""` | Enable sanitizer: address, memory, thread, undefined | || <a name="use_internal_lib_name_uc_library"></a>(`USE_INTERNAL_${LIB_NAME_UC}_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/contrib_finder.cmake#L6] | (`NOT_UNBUNDLED`)[#not_unbundled] | Use bundled library ${LIB_NAME} instead of system | || <a name="fuzzer"></a>(`FUZZER`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/fuzzer.cmake#L0] | `OFF` | Enable fuzzer: libfuzzer | || <a name="linker_name"></a>(`LINKER_NAME`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/tools.cmake#L42] | `OFF` | Linker name or full path | || <a name="enable_ssl"></a>(`ENABLE_SSL`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/ssl.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable ssl | |
| <a name="use_internal_ssl_library"></a>(`USE_INTERNAL_SSL_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/ssl.cmake#L3] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system *ssl library instead of bundled | || <a name="enable_gperf"></a>(`ENABLE_GPERF`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/gperf.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Use gperf function hash generator tool | || <a name="use_internal_sparsehash_library"></a>(`USE_INTERNAL_SPARSEHASH_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/sparsehash.cmake#L0] | `ON` | Set to FALSE to use system sparsehash library instead of bundled | || <a name="enable_base"></a>(`ENABLE_BASE64`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/base64.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable base64 | || <a name="use_internal_re_library"></a>(`USE_INTERNAL_RE2_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/re2.cmake#L0] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system re2 library instead of bundled [slower] | || <a name="enable_h"></a>(`ENABLE_H3`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/h3.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable H3 | |
| <a name="use_internal_h_library"></a>(`USE_INTERNAL_H3_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/h3.cmake#L2] | `ON` | Set to FALSE to use system h3 library instead of bundled | || <a name="enable_opencl"></a>(`ENABLE_OPENCL`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/opencl.cmake#L2] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable OpenCL support | || <a name="use_internal_libcxx_library"></a>(`USE_INTERNAL_LIBCXX_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/cxx.cmake#L3] | (`USE_INTERNAL_LIBCXX_LIBRARY_DEFAULT`)[#use_internal_libcxx_library_default] | Set to FALSE to use system libcxx and libcxxabi libraries instead of bundled | |
| <a name="use_libcxx"></a>(`USE_LIBCXX`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/cxx.cmake#L0] | (`NOT_UNBUNDLED`)[#not_unbundled] | Use libc++ and libc++abi instead of libstdc++ | || <a name="enable_mysql"></a>(`ENABLE_MYSQL`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/mysqlclient.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable MySQL | |
| <a name="enable_mysql"></a>(`ENABLE_MYSQL`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/mysqlclient.cmake#L1] | `FALSE` | Enable MySQL | |
| <a name="use_internal_mysql_library"></a>(`USE_INTERNAL_MYSQL_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/mysqlclient.cmake#L7] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system mysqlclient library instead of bundled | || <a name="use_internal_zlib_library"></a>(`USE_INTERNAL_ZLIB_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/zlib.cmake#L0] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system zlib library instead of bundled | || <a name="use_simdjson"></a>(`USE_SIMDJSON`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/simdjson.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Use simdjson | || <a name="use_internal_snappy_library"></a>(`USE_INTERNAL_SNAPPY_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/snappy.cmake#L3] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system snappy library instead of bundled | |
| <a name="use_snappy"></a>(`USE_SNAPPY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/snappy.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable support of snappy library | || <a name="use_sentry"></a>(`USE_SENTRY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/sentry.cmake#L4] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Use Sentry | || <a name="use_internal_zstd_library"></a>(`USE_INTERNAL_ZSTD_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/zstd.cmake#L0] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system zstd library instead of bundled | || <a name="enable_ldap"></a>(`ENABLE_LDAP`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/ldap.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable LDAP | |
| <a name="use_internal_ldap_library"></a>(`USE_INTERNAL_LDAP_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/ldap.cmake#L7] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system *LDAP library instead of bundled | || <a name="enable_curl"></a>(`ENABLE_CURL`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/curl.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable curl | |
| <a name="use_internal_curl"></a>(`USE_INTERNAL_CURL`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/curl.cmake#L3] | (`NOT_UNBUNDLED`)[#not_unbundled] | Use internal curl library | || <a name="enable_odbc"></a>(`ENABLE_ODBC`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/odbc.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable ODBC library | |
| <a name="use_internal_odbc_library"></a>(`USE_INTERNAL_ODBC_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/odbc.cmake#L10] | (`NOT_UNBUNDLED`)[#not_unbundled] | Use internal ODBC library | || <a name="use_internal_libxml_library"></a>(`USE_INTERNAL_LIBXML2_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/libxml2.cmake#L0] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system libxml2 library instead of bundled | || <a name="enable_stats"></a>(`ENABLE_STATS`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/stats.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enalbe StatsLib library | || <a name="enable_avro"></a>(`ENABLE_AVRO`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/avro.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable Avro | |
| <a name="use_internal_avro_library"></a>(`USE_INTERNAL_AVRO_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/avro.cmake#L3] | `ON` | Set to FALSE to use system avro library instead of bundled | || <a name="enable_gtest_library"></a>(`ENABLE_GTEST_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/gtest.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable gtest library | |
| <a name="use_internal_gtest_library"></a>(`USE_INTERNAL_GTEST_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/gtest.cmake#L3] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system Google Test instead of bundled | || <a name="enable_amqpcpp"></a>(`ENABLE_AMQPCPP`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/amqpcpp.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enalbe AMQP-CPP | || <a name="enable_icu"></a>(`ENABLE_ICU`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/icu.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable ICU | |
| <a name="enable_icu"></a>(`ENABLE_ICU`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/icu.cmake#L1] | `0` | Enable ICU | |
| <a name="use_internal_icu_library"></a>(`USE_INTERNAL_ICU_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/icu.cmake#L7] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system ICU library instead of bundled | || <a name="enable_ccache"></a>(`ENABLE_CCACHE`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/ccache.cmake#L6] | (`ENABLE_CCACHE_BY_DEFAULT`)[#enable_ccache_by_default] | Speedup re-compilations using ccache | || <a name="enable_parquet"></a>(`ENABLE_PARQUET`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/parquet.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable parquet | |
| <a name="use_internal_parquet_library"></a>(`USE_INTERNAL_PARQUET_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/parquet.cmake#L2] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system parquet library instead of bundled | || <a name="use_unwind"></a>(`USE_UNWIND`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/unwind.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable libunwind (better stacktraces) | || <a name="enable_brotli"></a>(`ENABLE_BROTLI`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/brotli.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable brotli | |
| <a name="use_internal_brotli_library"></a>(`USE_INTERNAL_BROTLI_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/brotli.cmake#L3] | (`USE_STATIC_LIBRARIES`)[#use_static_libraries] | Set to FALSE to use system libbrotli library instead of bundled | |
| <a name="use_internal_brotli_library"></a>(`USE_INTERNAL_BROTLI_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/brotli.cmake#L3] | `ON` | Set to FALSE to use system libbrotli library instead of bundled | || <a name="enable_msgpack"></a>(`ENABLE_MSGPACK`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/msgpack.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable msgpack library | |
| <a name="use_internal_msgpack_library"></a>(`USE_INTERNAL_MSGPACK_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/msgpack.cmake#L3] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system msgpack library instead of bundled | || <a name="enable_embedded_compiler"></a>(`ENABLE_EMBEDDED_COMPILER`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/llvm.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Set to TRUE to enable support for 'compile_expressions' option for query execution | |
| <a name="llvm_has_rtti"></a>(`LLVM_HAS_RTTI`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/llvm.cmake#L39] | `ON` | Enable if LLVM was build with RTTI enabled | |
| <a name="use_internal_llvm_library"></a>(`USE_INTERNAL_LLVM_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/llvm.cmake#L7] | (`NOT_UNBUNDLED`)[#not_unbundled] | Use bundled or system LLVM library. | || <a name="enable_hdfs"></a>(`ENABLE_HDFS`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/hdfs3.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable HDFS | |
| <a name="use_internal_hdfs_library"></a>(`USE_INTERNAL_HDFS3_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/hdfs3.cmake#L2] | `ON` | Set to FALSE to use system HDFS3 instead of bundled (experimental - set to OFF on your own risk) | || <a name="enable_gsasl_library"></a>(`ENABLE_GSASL_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/libgsasl.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable gsasl library | |
| <a name="use_internal_libgsasl_library"></a>(`USE_INTERNAL_LIBGSASL_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/libgsasl.cmake#L3] | (`USE_STATIC_LIBRARIES`)[#use_static_libraries] | Set to FALSE to use system libgsasl library instead of bundled | |
| <a name="use_internal_libgsasl_library"></a>(`USE_INTERNAL_LIBGSASL_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/libgsasl.cmake#L3] | `ON` | Set to FALSE to use system libgsasl library instead of bundled | || <a name="enable_fastops"></a>(`ENABLE_FASTOPS`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/fastops.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable fast vectorized mathematical functions library by Mikhail Parakhin | || <a name="enable_rdkafka"></a>(`ENABLE_RDKAFKA`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/rdkafka.cmake#L2] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable kafka | |
| <a name="use_internal_rdkafka_library"></a>(`USE_INTERNAL_RDKAFKA_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/rdkafka.cmake#L10] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system librdkafka instead of the bundled | || <a name="enable_orc"></a>(`ENABLE_ORC`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/orc.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable ORC | |
| <a name="use_internal_orc_library"></a>(`USE_INTERNAL_ORC_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/orc.cmake#L3] | `ON` | Set to FALSE to use system ORC instead of bundled (experimental set to OFF on your own risk) | || <a name="enable_cassandra"></a>(`ENABLE_CASSANDRA`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/cassandra.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable Cassandra | || <a name="enable_s"></a>(`ENABLE_S3`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/s3.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable S3 | |
| <a name="use_internal_aws_s_library"></a>(`USE_INTERNAL_AWS_S3_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/s3.cmake#L2] | `ON` | Set to FALSE to use system S3 instead of bundled (experimental set to OFF on your own risk) | || <a name="enable_rapidjson"></a>(`ENABLE_RAPIDJSON`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/rapidjson.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Use rapidjson | |
| <a name="use_internal_rapidjson_library"></a>(`USE_INTERNAL_RAPIDJSON_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/rapidjson.cmake#L2] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system rapidjson library instead of bundled | || <a name="use_internal_poco_library"></a>(`USE_INTERNAL_POCO_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/poco.cmake#L0] | `ON` | Use internal Poco library | || <a name="enable_grpc"></a>(`ENABLE_GRPC`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/grpc.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Use gRPC | |
| <a name="use_internal_grpc_library"></a>(`USE_INTERNAL_GRPC_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/grpc.cmake#L3] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system gRPC library instead of bundled. (Experimental. Set to OFF on your own risk) | || <a name="enable_protobuf"></a>(`ENABLE_PROTOBUF`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/protobuf.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable protobuf | |
| <a name="use_internal_protobuf_library"></a>(`USE_INTERNAL_PROTOBUF_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/protobuf.cmake#L3] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system protobuf instead of bundled | || <a name="enable_capnp"></a>(`ENABLE_CAPNP`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/capnp.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable Cap'n Proto | |
| <a name="use_internal_capnp_library"></a>(`USE_INTERNAL_CAPNP_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/capnp.cmake#L3] | (`NOT_UNBUNDLED`)[#not_unbundled] | Set to FALSE to use system capnproto library instead of bundled | || <a name="enable_multitarget_code"></a>(`ENABLE_MULTITARGET_CODE`)[https://github.com/clickhouse/clickhouse/blob/master/src/Functions/CMakeLists.txt#L117] | `ON` | | |
| <a name="strip_debug_symbols_functions"></a>(`STRIP_DEBUG_SYMBOLS_FUNCTIONS`)[https://github.com/clickhouse/clickhouse/blob/master/src/Functions/CMakeLists.txt#L64] | (`STRIP_DSF_DEFAULT`)[#strip_dsf_default] | Do not generate debugger info for ClickHouse functions.
Provides faster linking and lower binary size.
Tradeoff is the inability to debug some source files with e.g. gdb
(empty stack frames and no local variables). | || <a name="enable_clickhouse_all"></a>(`ENABLE_CLICKHOUSE_ALL`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L8] | `ON` | Enable all tools | |
| <a name="enable_clickhouse_benchmark"></a>(`ENABLE_CLICKHOUSE_BENCHMARK`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L12] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-benchmark | |
| <a name="enable_clickhouse_client"></a>(`ENABLE_CLICKHOUSE_CLIENT`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L10] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-client | |
| <a name="enable_clickhouse_compressor"></a>(`ENABLE_CLICKHOUSE_COMPRESSOR`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L14] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-compressor | |
| <a name="enable_clickhouse_copier"></a>(`ENABLE_CLICKHOUSE_COPIER`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L15] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-copier | |
| <a name="enable_clickhouse_extract_from_config"></a>(`ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L13] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-extract-from-config | |
| <a name="enable_clickhouse_format"></a>(`ENABLE_CLICKHOUSE_FORMAT`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L16] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-format | |
| <a name="enable_clickhouse_install"></a>(`ENABLE_CLICKHOUSE_INSTALL`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L21] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-install | |
| <a name="enable_clickhouse_install"></a>(`ENABLE_CLICKHOUSE_INSTALL`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L21] | `OFF` | Enable clickhouse-install | |
| <a name="enable_clickhouse_local"></a>(`ENABLE_CLICKHOUSE_LOCAL`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L11] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-local | |
| <a name="enable_clickhouse_obfuscator"></a>(`ENABLE_CLICKHOUSE_OBFUSCATOR`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L17] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-obfuscator | |
| <a name="enable_clickhouse_odbc_bridge"></a>(`ENABLE_CLICKHOUSE_ODBC_BRIDGE`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L18] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-odbc-bridge | |
| <a name="enable_clickhouse_server"></a>(`ENABLE_CLICKHOUSE_SERVER`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L9] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-server | |
## Developer's guide for adding new CMake options
### Don't be obvious. Be informative.
@ -122,116 +202,4 @@ CMake allows you to pass a plethora of values representing boolean `true/false`,
Prefer the `ON/OFF` values, if possible.
## List of CMake flags
* This list is auto-generated by [this bash script](cmake_flags_md_generator.sh).
* The flag name is a link to its position in the code.
| Name | Default value | Description | Comment |
|------|---------------|-------------|---------|
| [`ENABLE_IPO`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `` | Enable full link time optimization | |
| [`USE_STATIC_LIBRARIES`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `ON` | Set to FALSE to use shared libraries | |
| [`MAKE_STATIC_LIBRARIES`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `${USE_STATIC_LIBRARIES}` | Set to FALSE to make shared libraries | |
| [`SPLIT_SHARED_LIBRARIES`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `OFF` | DEV ONLY. Keep all internal libs as separate .so for faster linking | |
| [`CLICKHOUSE_SPLIT_BINARY`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `OFF` | Make several binaries instead one bundled (clickhouse-server, clickhouse-client, ... ) | |
| [`ENABLE_FUZZING`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `OFF` | Enables fuzzing instrumentation | |
| [`ENABLE_TESTS`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `ON` | Enables tests | |
| [`GLIBC_COMPATIBILITY`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `ON` | Set to TRUE to enable compatibility with older glibc libraries. Only for x86_64, Linux. Implies ENABLE_FASTMEMCPY. | |
| [`ADD_GDB_INDEX_FOR_GOLD`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `0` | Set to add .gdb-index to resulting binaries for gold linker. NOOP if lld is used. | |
| [`COMPILER_PIPE`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `ON` | -pipe compiler option [less /tmp usage, more ram usage] | |
| [`ARCH_NATIVE`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `0` | Enable -march=native compiler flag | |
| [`WITH_COVERAGE`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `0` | Build with coverage. | |
| [`ENABLE_THINLTO`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `ON` | Enable Thin LTO. Only applicable for clang. It's also suppressed when building with tests or sanitizers. | |
| [`ENABLE_LIBRARIES`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `ON` | Enable all libraries (Global default switch) | |
| [`UNBUNDLED`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `OFF` | Try find all libraries in system. We recommend to avoid this mode for production builds, because we cannot guarantee exact versions and variants of libraries your system has installed. This mode exists for enthusiastic developers who search for trouble. Also it is useful for maintainers of OS packages. | |
| [`WERROR`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `OFF` | Enable -Werror compiler option | |
| [`WERROR`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `ON` | Enable -Werror compiler option | |
| [`USE_INCLUDE_WHAT_YOU_USE`](http://github.com/clickhouse/clickhouse/blob/master//CMakeLists.txt) | `OFF` | Use 'include-what-you-use' tool | |
| [`ENABLE_CLANG_TIDY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/analysis.cmake) | `OFF` | Use 'clang-tidy' static analyzer if present | |
| [`USE_INTERNAL_`](http://github.com/clickhouse/clickhouse/blob/master/cmake/contrib_finder.cmake) | `${LIB_NAME_UC}_LIBRARY "Use bundled library ${LIB_NAME} instead of system" ${NOT_UNBUNDLED}` | | |
| [`FUZZER`](http://github.com/clickhouse/clickhouse/blob/master/cmake/fuzzer.cmake) | `` | Enable fuzzer: libfuzzer | |
| [`PARALLEL_COMPILE_JOBS`](http://github.com/clickhouse/clickhouse/blob/master/cmake/limit_jobs.cmake) | `` | Define the maximum number of concurrent compilation jobs" " | |
| [`PARALLEL_LINK_JOBS`](http://github.com/clickhouse/clickhouse/blob/master/cmake/limit_jobs.cmake) | `` | Define the maximum number of concurrent link jobs" " | |
| [`SANITIZE`](http://github.com/clickhouse/clickhouse/blob/master/cmake/sanitize.cmake) | `` | Enable sanitizer: address, memory, thread, undefined" " | |
| [`LINKER_NAME`](http://github.com/clickhouse/clickhouse/blob/master/cmake/tools.cmake) | `` | Linker name or full path | |
| [`WEVERYTHING`](http://github.com/clickhouse/clickhouse/blob/master/cmake/warnings.cmake) | `ON` | Enables -Weverything option with some exceptions. This is intended for exploration of new compiler warnings that may be found to be useful. Only makes sense for clang. | |
| [`ENABLE_AMQPCPP`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/amqpcpp.cmake) | `${ENABLE_LIBRARIES}` | Enalbe AMQP-CPP | |
| [`ENABLE_AVRO`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/avro.cmake) | `${ENABLE_LIBRARIES}` | Enable Avro | |
| [`ENABLE_BASE`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/base64.cmake) | `64 "Enable base64" ${ENABLE_LIBRARIES}` | | |
| [`ENABLE_BROTLI`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/brotli.cmake) | `${ENABLE_LIBRARIES}` | Enable brotli | |
| [`USE_INTERNAL_BROTLI_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/brotli.cmake) | `${USE_STATIC_LIBRARIES}` | Set to FALSE to use system libbrotli library instead of bundled | |
| [`USE_INTERNAL_BROTLI_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/brotli.cmake) | `ON` | Set to FALSE to use system libbrotli library instead of bundled | |
| [`ENABLE_CAPNP`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/capnp.cmake) | `${ENABLE_LIBRARIES}` | Enable Cap'n Proto | |
| [`USE_INTERNAL_CAPNP_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/capnp.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system capnproto library instead of bundled | |
| [`ENABLE_CASSANDRA`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/cassandra.cmake) | `${ENABLE_LIBRARIES}` | Enable Cassandra | |
| [`ENABLE_CCACHE`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/ccache.cmake) | `${ENABLE_CCACHE_BY_DEFAULT}` | Speedup re-compilations using ccache | |
| [`ENABLE_CURL`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/curl.cmake) | `${ENABLE_LIBRARIES}` | Enable curl | |
| [`USE_INTERNAL_CURL`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/curl.cmake) | `${NOT_UNBUNDLED}` | Use internal curl library | |
| [`USE_LIBCXX`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/cxx.cmake) | `${NOT_UNBUNDLED}` | Use libc++ and libc++abi instead of libstdc++ | |
| [`USE_INTERNAL_LIBCXX_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/cxx.cmake) | `${USE_INTERNAL_LIBCXX_LIBRARY_DEFAULT}` | Set to FALSE to use system libcxx and libcxxabi libraries instead of bundled | |
| [`ENABLE_FASTOPS`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/fastops.cmake) | `${ENABLE_LIBRARIES}` | Enable fast vectorized mathematical functions library by Mikhail Parakhin | |
| [`ENABLE_GPERF`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/gperf.cmake) | `${ENABLE_LIBRARIES}` | Use gperf function hash generator tool | |
| [`ENABLE_GRPC`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/grpc.cmake) | `${ENABLE_LIBRARIES}` | Use gRPC | |
| [`ENABLE_GTEST_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/gtest.cmake) | `${ENABLE_LIBRARIES}` | Enable gtest library | |
| [`USE_INTERNAL_GTEST_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/gtest.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system Google Test instead of bundled | |
| [`ENABLE_H`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/h3.cmake) | `3 "Enable H3" ${ENABLE_LIBRARIES}` | | |
| [`ENABLE_HDFS`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/hdfs3.cmake) | `${ENABLE_LIBRARIES}` | Enable HDFS | |
| [`USE_INTERNAL_HDFS`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/hdfs3.cmake) | `3_LIBRARY "Set to FALSE to use system HDFS3 instead of bundled (experimental - set to OFF on your own risk` | | |
| [`ENABLE_ICU`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/icu.cmake) | `${ENABLE_LIBRARIES}` | Enable ICU | |
| [`ENABLE_ICU`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/icu.cmake) | `0` | Enable ICU | |
| [`USE_INTERNAL_ICU_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/icu.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system ICU library instead of bundled | |
| [`ENABLE_LDAP`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/ldap.cmake) | `${ENABLE_LIBRARIES}` | Enable LDAP | |
| [`USE_INTERNAL_LDAP_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/ldap.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system *LDAP library instead of bundled | |
| [`ENABLE_GSASL_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/libgsasl.cmake) | `${ENABLE_LIBRARIES}` | Enable gsasl library | |
| [`USE_INTERNAL_LIBGSASL_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/libgsasl.cmake) | `${USE_STATIC_LIBRARIES}` | Set to FALSE to use system libgsasl library instead of bundled | |
| [`USE_INTERNAL_LIBGSASL_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/libgsasl.cmake) | `ON` | Set to FALSE to use system libgsasl library instead of bundled | |
| [`USE_INTERNAL_LIBXML`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/libxml2.cmake) | `2_LIBRARY "Set to FALSE to use system libxml2 library instead of bundled" ${NOT_UNBUNDLED}` | | |
| [`ENABLE_EMBEDDED_COMPILER`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/llvm.cmake) | `${ENABLE_LIBRARIES}` | Set to TRUE to enable support for 'compile_expressions' option for query execution | |
| [`USE_INTERNAL_LLVM_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/llvm.cmake) | `${NOT_UNBUNDLED}` | Use bundled or system LLVM library. | |
| [`LLVM_HAS_RTTI`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/llvm.cmake) | `ON` | Enable if LLVM was build with RTTI enabled | |
| [`ENABLE_MSGPACK`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/msgpack.cmake) | `${ENABLE_LIBRARIES}` | Enable msgpack library | |
| [`USE_INTERNAL_MSGPACK_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/msgpack.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system msgpack library instead of bundled | |
| [`ENABLE_MYSQL`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/mysqlclient.cmake) | `${ENABLE_LIBRARIES}` | Enable MySQL | |
| [`ENABLE_MYSQL`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/mysqlclient.cmake) | `FALSE` | Enable MySQL | |
| [`USE_INTERNAL_MYSQL_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/mysqlclient.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system mysqlclient library instead of bundled | |
| [`ENABLE_ODBC`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/odbc.cmake) | `${ENABLE_LIBRARIES}` | Enable ODBC library | |
| [`USE_INTERNAL_ODBC_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/odbc.cmake) | `${NOT_UNBUNDLED}` | Use internal ODBC library | |
| [`ENABLE_OPENCL`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/opencl.cmake) | `${ENABLE_LIBRARIES}` | Enable OpenCL support | |
| [`ENABLE_ORC`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/orc.cmake) | `${ENABLE_LIBRARIES}` | Enable ORC | |
| [`USE_INTERNAL_ORC_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/orc.cmake) | `"Set to FALSE to use system ORC instead of bundled (experimental set to OFF on your own risk` | | |
| [`ENABLE_PARQUET`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/parquet.cmake) | `${ENABLE_LIBRARIES}` | Enable parquet | |
| [`USE_INTERNAL_PARQUET_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/parquet.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system parquet library instead of bundled | |
| [`USE_INTERNAL_POCO_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/poco.cmake) | `ON` | Use internal Poco library | |
| [`ENABLE_PROTOBUF`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/protobuf.cmake) | `${ENABLE_LIBRARIES}` | Enable protobuf | |
| [`USE_INTERNAL_PROTOBUF_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/protobuf.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system protobuf instead of bundled | |
| [`ENABLE_RAPIDJSON`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/rapidjson.cmake) | `${ENABLE_LIBRARIES}` | Use rapidjson | |
| [`USE_INTERNAL_RAPIDJSON_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/rapidjson.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system rapidjson library instead of bundled | |
| [`ENABLE_RDKAFKA`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/rdkafka.cmake) | `${ENABLE_LIBRARIES}` | Enable kafka | |
| [`USE_INTERNAL_RDKAFKA_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/rdkafka.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system librdkafka instead of the bundled | |
| [`USE_INTERNAL_RE`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/re2.cmake) | `2_LIBRARY "Set to FALSE to use system re2 library instead of bundled [slower]" ${NOT_UNBUNDLED}` | | |
| [`ENABLE_S`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/s3.cmake) | `3 "Enable S3" ${ENABLE_LIBRARIES}` | | |
| [`USE_INTERNAL_AWS_S`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/s3.cmake) | `3_LIBRARY "Set to FALSE to use system S3 instead of bundled (experimental set to OFF on your own risk` | | |
| [`USE_SENTRY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/sentry.cmake) | `${ENABLE_LIBRARIES}` | Use Sentry | |
| [`USE_SIMDJSON`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/simdjson.cmake) | `${ENABLE_LIBRARIES}` | Use simdjson | |
| [`USE_SNAPPY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/snappy.cmake) | `${ENABLE_LIBRARIES}` | Enable support of snappy library | |
| [`USE_INTERNAL_SNAPPY_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/snappy.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system snappy library instead of bundled | |
| [`ENABLE_SSL`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/ssl.cmake) | `${ENABLE_LIBRARIES}` | Enable ssl | |
| [`USE_INTERNAL_SSL_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/ssl.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system *ssl library instead of bundled | |
| [`ENABLE_STATS`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/stats.cmake) | `${ENABLE_LIBRARIES}` | Enalbe StatsLib library | |
| [`USE_UNWIND`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/unwind.cmake) | `${ENABLE_LIBRARIES}` | Enable libunwind (better stacktraces) | |
| [`USE_INTERNAL_ZLIB_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/zlib.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system zlib library instead of bundled | |
| [`USE_INTERNAL_ZSTD_LIBRARY`](http://github.com/clickhouse/clickhouse/blob/master/cmake/find/zstd.cmake) | `${NOT_UNBUNDLED}` | Set to FALSE to use system zstd library instead of bundled | |
| [`ENABLE_CLICKHOUSE_ALL`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `ON` | Enable all tools | |
| [`ENABLE_CLICKHOUSE_SERVER`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `${ENABLE_CLICKHOUSE_ALL}` | Enable clickhouse-server | |
| [`ENABLE_CLICKHOUSE_CLIENT`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `${ENABLE_CLICKHOUSE_ALL}` | Enable clickhouse-client | |
| [`ENABLE_CLICKHOUSE_LOCAL`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `${ENABLE_CLICKHOUSE_ALL}` | Enable clickhouse-local | |
| [`ENABLE_CLICKHOUSE_BENCHMARK`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `${ENABLE_CLICKHOUSE_ALL}` | Enable clickhouse-benchmark | |
| [`ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `${ENABLE_CLICKHOUSE_ALL}` | Enable clickhouse-extract-from-config | |
| [`ENABLE_CLICKHOUSE_COMPRESSOR`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `${ENABLE_CLICKHOUSE_ALL}` | Enable clickhouse-compressor | |
| [`ENABLE_CLICKHOUSE_COPIER`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `${ENABLE_CLICKHOUSE_ALL}` | Enable clickhouse-copier | |
| [`ENABLE_CLICKHOUSE_FORMAT`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `${ENABLE_CLICKHOUSE_ALL}` | Enable clickhouse-format | |
| [`ENABLE_CLICKHOUSE_OBFUSCATOR`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `${ENABLE_CLICKHOUSE_ALL}` | Enable clickhouse-obfuscator | |
| [`ENABLE_CLICKHOUSE_ODBC_BRIDGE`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `${ENABLE_CLICKHOUSE_ALL}` | Enable clickhouse-odbc-bridge | |
| [`ENABLE_CLICKHOUSE_INSTALL`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `OFF` | Enable clickhouse-install | |
| [`ENABLE_CLICKHOUSE_INSTALL`](http://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt) | `${ENABLE_CLICKHOUSE_ALL}` | Enable clickhouse-install | |
| [`ENABLE_MULTITARGET_CODE`](http://github.com/clickhouse/clickhouse/blob/master/src/Functions/CMakeLists.txt) | `ON` | | |

104
cmake_flags_generator.py Executable file
View File

@ -0,0 +1,104 @@
import re
import os.path
from typing import TextIO, List, Tuple, Optional
Entity = Tuple[str, str, str]
# https://regex101.com/r/R6iogw/11
cmake_option_regex: str = r"^\s*option\s*\(([A-Z_0-9${}]+)\s*(?:\"((?:.|\n)*?)\")?\s*(.*)?\).*$"
output_file_name: str = "cmake_flags_and_output.md"
header_file_name: str = "cmake_files_header.md"
footer_file_name: str = "cmake_files_footer.md"
ch_master_url: str = "https://github.com/clickhouse/clickhouse/blob/master/"
name_str: str = "<a name=\"{anchor}\"></a>(`{name}`)[" + ch_master_url + "{path}#L{line}]"
default_anchor_str: str = "(`{name}`)[#{anchor}]"
def build_entity(path: str, entity: Entity, line_comment: Tuple[int, str]) -> str:
(line, comment) = line_comment
(_name, description, default) = entity
def anchor(t: str) -> str:
return ''.join([i.lower() for i in t if i.isalpha() or i == "_"])
if (len(default) == 0):
default = "`OFF`"
elif default[0] == "$":
default = default[2:-1]
default = default_anchor_str.format(
name=default,
anchor=anchor(default))
else:
default = "`" + default + "`"
name: str = name_str.format(
anchor=anchor(_name),
name=_name,
path=path,
line=line)
return "| " + name + " | " + default + " | " + description + " | " + comment + " |"
def process_file(input_name: str) -> List[str]:
print("Processing", input_name)
out: List[str] = []
with open(input_name, 'r') as cmake_file:
contents: str = cmake_file.read()
def get_line_and_comment(target: str) -> Tuple[int, str]:
contents_list: List[str] = contents.split("\n")
comment: str = ""
for n, line in enumerate(contents_list):
if line.find(target) == -1:
continue
for maybe_comment_line in contents_list[n::-1]:
if (re.match("\s*#\s*", maybe_comment_line)):
comment = re.sub("\s*#\s*", "", maybe_comment_line) + "\n" + comment
else:
break
return n, comment
matches: Optional[List[Entity]] = re.findall(cmake_option_regex, contents, re.MULTILINE)
if matches:
for entity in matches:
out.append(build_entity(input_name, entity, get_line_and_comment(entity[0])))
return out
def write_file(output: TextIO, in_file_name: str) -> None:
output.write("\n".join(sorted(process_file(in_file_name))))
def process_folder(output: TextIO, name: str) -> None:
for root, _, files in os.walk(name):
print("Processing ", root)
for f in files:
if f == "CMakeLists.txt" or ".cmake" in f:
write_file(output, root + "/" + f)
def process() -> None:
with open(output_file_name, "w") as f:
with open(header_file_name, "r") as header:
f.write(header.read())
write_file(f, "CMakeLists.txt")
write_file(f, "PreLoad.cmake")
process_folder(f, "base")
process_folder(f, "cmake")
process_folder(f, "src")
process_folder(f, "programs")
process_folder(f, "utils")
with open(footer_file_name, "r") as footer:
f.write(footer.read())
process()

View File

@ -1,38 +0,0 @@
#!/bin/bash/
# https://regex101.com/r/R6iogw/7
output_file_name="cmake_flags_and_output.md"
ch_master_url="http:\/\/github.com\/clickhouse\/clickhouse\/blob\/master\/"
rm -fr ${output_file_name}
touch ${output_file_name}
cat cmake_files_header.md >> ${output_file_name}
process() {
for i in "$1"/*.cmake "$1"/CMakeLists.txt;do
echo "Processing $i"
subd_name=${i//\//\\/}
subd_name=${subd_name//\./\\\.}
subd_name=${subd_name:2}
regex='s/^((\s*#\s+.*\n?)*)\s*option\s*\(([A-Z_]+)\s*(\"((.|\n)*?)\")?\s*(.*)?\).*$/| [`\3`]('$ch_master_url${subd_name:2}') | `\7` | \5 | \1 |/mg;t;d'
if [ -f $i ]; then
cat $i | sed -E "$regex" >> ${output_file_name}
fi
done
if [ "$2" = true ] ; then
for d in "$1"/*;do
if [ -d "$d" ];then
process $d
fi
done
fi
}
process ./ false
for base_folder in ./base ./cmake ./programs ./src; do
process $base_folder true
done