diff --git a/CMakeLists.txt b/CMakeLists.txt index 09a4500e314..01fb16f46b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +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) @@ -60,7 +61,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Need cmake 3.9+ # Usually impractical. # See also ENABLE_THINLTO -option(ENABLE_IPO "Enable full link time optimization") +option(ENABLE_IPO "Full link time optimization") if(ENABLE_IPO) cmake_policy(SET CMP0069 NEW) @@ -91,12 +92,16 @@ message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") 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}) +option(USE_STATIC_LIBRARIES "Disable to use shared libraries" ON) +option(MAKE_STATIC_LIBRARIES "Disable 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) + # DEVELOPER ONLY. + # Faster linking if turned on. + option(SPLIT_SHARED_LIBRARIES "Keep all internal libraries as separate .so files") + + option(CLICKHOUSE_SPLIT_BINARY + "Make several binaries (clickhouse-server, clickhouse-client etc.) instead of one bundled") endif () if (MAKE_STATIC_LIBRARIES AND SPLIT_SHARED_LIBRARIES) @@ -111,7 +116,9 @@ if (USE_STATIC_LIBRARIES) list(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) endif () -option (ENABLE_FUZZING "Enables fuzzing instrumentation" OFF) +# Enable fuzzy testing using libfuzzer +# Implies ${WITH_COVERAGE} +option (ENABLE_FUZZING "Enables fuzzing instrumentation") if (ENABLE_FUZZING) message (STATUS "Fuzzing instrumentation enabled") @@ -143,10 +150,13 @@ if (COMPILER_CLANG) endif () endif () -option (ENABLE_TESTS "Enables tests" ON) +# Adds a Google.Test target binary containing unit tests. +option (ENABLE_TESTS ON) if (OS_LINUX AND NOT UNBUNDLED AND MAKE_STATIC_LIBRARIES AND NOT SPLIT_SHARED_LIBRARIES AND CMAKE_VERSION VERSION_GREATER "3.9.0") - option (GLIBC_COMPATIBILITY "Set to TRUE to enable compatibility with older glibc libraries. Only for x86_64, Linux. Implies ENABLE_FASTMEMCPY." ON) + # Only for Linux, x86_64. + # Implies ${ENABLE_FASTMEMCPY} + option(GLIBC_COMPATIBILITY "Enable compatibility with older glibc libraries." ON) elseif(GLIBC_COMPATIBILITY) message (${RECONFIGURE_MESSAGE_LEVEL} "Glibc compatibility cannot be enabled in current configuration") endif () @@ -179,7 +189,8 @@ else () set(NO_WHOLE_ARCHIVE --no-whole-archive) endif () -option (ADD_GDB_INDEX_FOR_GOLD "Set to add .gdb-index to resulting binaries for gold linker. NOOP if lld is used." 0) +option(ADD_GDB_INDEX_FOR_GOLD "Add .gdb-index to resulting binaries for gold linker. NOOP if lld is used.") + if (NOT CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE") if (LINKER_NAME STREQUAL "lld") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index") @@ -200,6 +211,7 @@ if (NOT CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE") endif() cmake_host_system_information(RESULT AVAILABLE_PHYSICAL_MEMORY QUERY AVAILABLE_PHYSICAL_MEMORY) # Not available under freebsd + if(NOT AVAILABLE_PHYSICAL_MEMORY OR AVAILABLE_PHYSICAL_MEMORY GREATER 8000) option(COMPILER_PIPE "-pipe compiler option [less /tmp usage, more ram usage]" ON) endif() @@ -213,7 +225,8 @@ if(NOT DISABLE_CPU_OPTIMIZE) include(cmake/cpu_features.cmake) endif() -option(ARCH_NATIVE "Enable -march=native compiler flag" 0) +option(ARCH_NATIVE "Add -march=native compiler flag") + if (ARCH_NATIVE) set (COMPILER_FLAGS "${COMPILER_FLAGS} -march=native") endif () @@ -224,6 +237,7 @@ if (UNBUNDLED AND (COMPILER_GCC OR COMPILER_CLANG)) else() set (_CXX_STANDARD "-std=c++2a") endif() + # cmake < 3.12 doesn't support 20. We'll set CMAKE_CXX_FLAGS for now # set (CMAKE_CXX_STANDARD 20) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_CXX_STANDARD}") @@ -236,7 +250,8 @@ if (COMPILER_GCC OR COMPILER_CLANG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsized-deallocation") endif () -option(WITH_COVERAGE "Build with coverage." 0) +# Compiler-specific coverage flags e.g. -fcoverage-mapping for gcc +option(WITH_COVERAGE) if (WITH_COVERAGE AND COMPILER_CLANG) set(COMPILER_FLAGS "${COMPILER_FLAGS} -fprofile-instr-generate -fcoverage-mapping") @@ -270,10 +285,13 @@ if (COMPILER_CLANG) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-absolute-paths") if (NOT ENABLE_TESTS AND NOT SANITIZE) - option(ENABLE_THINLTO "Enable Thin LTO. Only applicable for clang. It's also suppressed when building with tests or sanitizers." ON) + # https://clang.llvm.org/docs/ThinLTO.html + # Applies to clang only. + # Disabled when building with tests or sanitizers. + option(ENABLE_THINLTO ON) endif() - # We cannot afford to use LTO when compiling unitests, and it's not enough + # We cannot afford to use LTO when compiling unit tests, and it's not enough # to only supply -fno-lto at the final linking stage. So we disable it # completely. if (ENABLE_THINLTO AND NOT ENABLE_TESTS AND NOT SANITIZE) @@ -286,8 +304,8 @@ if (COMPILER_CLANG) endif () # Always prefer llvm tools when using clang. For instance, we cannot use GNU ar when llvm LTO is enabled - find_program (LLVM_AR_PATH NAMES "llvm-ar" "llvm-ar-10" "llvm-ar-9" "llvm-ar-8") + if (LLVM_AR_PATH) message(STATUS "Using llvm-ar: ${LLVM_AR_PATH}.") set (CMAKE_AR ${LLVM_AR_PATH}) @@ -306,20 +324,25 @@ elseif (ENABLE_THINLTO) message (${RECONFIGURE_MESSAGE_LEVEL} "ThinLTO is only available with CLang") endif () -option (ENABLE_LIBRARIES "Enable all libraries (Global default switch)" ON) +option(ENABLE_LIBRARIES "Enable all libraries (Global default switch)" ON) + +# We recommend avoiding this mode for production builds because we can't guarantee all needed libraries exist in your +# system. +# This mode exists for enthusiastic developers who are searching for trouble. +# Useful for maintainers of OS packages. +option (UNBUNDLED "Use system libraries instead of ones in contrib/") -option (UNBUNDLED "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." OFF) if (UNBUNDLED) - set(NOT_UNBUNDLED 0) + set(NOT_UNBUNDLED OFF) else () - set(NOT_UNBUNDLED 1) + set(NOT_UNBUNDLED ON) endif () if (UNBUNDLED OR NOT (OS_LINUX OR OS_DARWIN)) # Using system libs can cause a lot of warnings in includes (on macro expansion). - option (WERROR "Enable -Werror compiler option" OFF) + option(WERROR "Enable -Werror compiler option") else () - option (WERROR "Enable -Werror compiler option" ON) + option(WERROR "Enable -Werror compiler option" ON) endif () if (WERROR) @@ -361,8 +384,9 @@ else () set (CMAKE_POSITION_INDEPENDENT_CODE ON) endif () -# Using "include-what-you-use" tool. -option (USE_INCLUDE_WHAT_YOU_USE "Use 'include-what-you-use' tool" OFF) +# https://github.com/include-what-you-use/include-what-you-use +option (USE_INCLUDE_WHAT_YOU_USE) + if (USE_INCLUDE_WHAT_YOU_USE) find_program(IWYU_PATH NAMES include-what-you-use iwyu) if (NOT IWYU_PATH) @@ -376,6 +400,7 @@ endif () if (ENABLE_TESTS) message (STATUS "Tests are enabled") endif () + enable_testing() # Enable for tests without binary # when installing to /usr - place configs to /etc but for /usr/local place to /usr/local/etc @@ -385,7 +410,13 @@ else () set (CLICKHOUSE_ETC_DIR "${CMAKE_INSTALL_PREFIX}/etc") endif () -message (STATUS "Building for: ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_PROCESSOR} ${CMAKE_LIBRARY_ARCHITECTURE} ; USE_STATIC_LIBRARIES=${USE_STATIC_LIBRARIES} MAKE_STATIC_LIBRARIES=${MAKE_STATIC_LIBRARIES} SPLIT_SHARED=${SPLIT_SHARED_LIBRARIES} UNBUNDLED=${UNBUNDLED} CCACHE=${CCACHE_FOUND} ${CCACHE_VERSION}") +message (STATUS + "Building for: ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_PROCESSOR} ${CMAKE_LIBRARY_ARCHITECTURE} ; + USE_STATIC_LIBRARIES=${USE_STATIC_LIBRARIES} + MAKE_STATIC_LIBRARIES=${MAKE_STATIC_LIBRARIES} + SPLIT_SHARED=${SPLIT_SHARED_LIBRARIES} + UNBUNDLED=${UNBUNDLED} + CCACHE=${CCACHE_FOUND} ${CCACHE_VERSION}") include (GNUInstallDirs) include (cmake/contrib_finder.cmake) diff --git a/cmake_flags_and_output.md b/cmake_flags_and_output.md index 11f5ed36496..42d6248e94f 100644 --- a/cmake_flags_and_output.md +++ b/cmake_flags_and_output.md @@ -12,75 +12,68 @@ TODO describe separate cmake files for contrib + arch-dependent ones + options f | Name | Default value | Description | Comment | |------|---------------|-------------|---------| -| (`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. | | -| (`ARCH_NATIVE`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L215] | `0` | Enable -march=native compiler flag | | -| (`CLICKHOUSE_SPLIT_BINARY`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L98] | `OFF` | Make several binaries instead one bundled (clickhouse-server, clickhouse-client, ... ) | | -| (`COMPILER_PIPE`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L203] | `ON` | -pipe compiler option [less /tmp usage, more ram usage] | | -| (`ENABLE_FUZZING`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L113] | `OFF` | Enables fuzzing instrumentation | | -| (`ENABLE_IPO`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L62] | `OFF` | Enable full link time optimization | | -| (`ENABLE_LIBRARIES`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L308] | `ON` | Enable all libraries (Global default switch) | | -| (`ENABLE_TESTS`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L145] | `ON` | Enables tests | | -| (`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 - | -| (`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 | | -| (`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. | | -| (`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 | | -| (`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 | | -| (`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. | | -| (`USE_INCLUDE_WHAT_YOU_USE`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L364] | `OFF` | Use 'include-what-you-use' tool | | -| (`USE_STATIC_LIBRARIES`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L93] | `ON` | Set to FALSE to use shared libraries | | -| (`WERROR`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L319] | `OFF` | Enable -Werror compiler option | | -| (`WERROR`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L319] | `ON` | Enable -Werror compiler option | | -| (`WITH_COVERAGE`)[https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L117] | `0` | Build with coverage. | || (`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. | || (`PARALLEL_COMPILE_JOBS`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/limit_jobs.cmake#L8] | `""` | Define the maximum number of concurrent compilation jobs | | -| (`PARALLEL_LINK_JOBS`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/limit_jobs.cmake#L21] | `""` | Define the maximum number of concurrent link jobs | || (`ENABLE_CLANG_TIDY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/analysis.cmake#L2] | `OFF` | Use 'clang-tidy' static analyzer if present | || (`SANITIZE`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/sanitize.cmake#L0] | `""` | Enable sanitizer: address, memory, thread, undefined | || (`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 | || (`FUZZER`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/fuzzer.cmake#L0] | `OFF` | Enable fuzzer: libfuzzer | || (`LINKER_NAME`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/tools.cmake#L42] | `OFF` | Linker name or full path | || (`ENABLE_SSL`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/ssl.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable ssl | | -| (`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 | || (`ENABLE_GPERF`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/gperf.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Use gperf function hash generator tool | || (`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 | || (`ENABLE_BASE64`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/base64.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable base64 | || (`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] | || (`ENABLE_H3`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/h3.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable H3 | | -| (`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 | || (`ENABLE_OPENCL`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/opencl.cmake#L2] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable OpenCL support | || (`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 | | -| (`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++ | || (`ENABLE_MYSQL`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/mysqlclient.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable MySQL | | -| (`ENABLE_MYSQL`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/mysqlclient.cmake#L1] | `FALSE` | Enable MySQL | | -| (`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 | || (`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 | || (`USE_SIMDJSON`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/simdjson.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Use simdjson | || (`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 | | -| (`USE_SNAPPY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/snappy.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable support of snappy library | || (`USE_SENTRY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/sentry.cmake#L4] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Use Sentry | || (`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 | || (`ENABLE_LDAP`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/ldap.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable LDAP | | -| (`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 | || (`ENABLE_CURL`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/curl.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable curl | | -| (`USE_INTERNAL_CURL`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/curl.cmake#L3] | (`NOT_UNBUNDLED`)[#not_unbundled] | Use internal curl library | || (`ENABLE_ODBC`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/odbc.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable ODBC library | | -| (`USE_INTERNAL_ODBC_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/odbc.cmake#L10] | (`NOT_UNBUNDLED`)[#not_unbundled] | Use internal ODBC library | || (`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 | || (`ENABLE_STATS`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/stats.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enalbe StatsLib library | || (`ENABLE_AVRO`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/avro.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable Avro | | -| (`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 | || (`ENABLE_GTEST_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/gtest.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable gtest library | | -| (`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 | || (`ENABLE_AMQPCPP`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/amqpcpp.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enalbe AMQP-CPP | || (`ENABLE_ICU`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/icu.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable ICU | | -| (`ENABLE_ICU`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/icu.cmake#L1] | `0` | Enable ICU | | -| (`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 | || (`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 | || (`ENABLE_PARQUET`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/parquet.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable parquet | | -| (`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 | || (`USE_UNWIND`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/unwind.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable libunwind (better stacktraces) | || (`ENABLE_BROTLI`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/brotli.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable brotli | | -| (`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 | | -| (`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 | || (`ENABLE_MSGPACK`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/msgpack.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable msgpack library | | -| (`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 | || (`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 | | -| (`LLVM_HAS_RTTI`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/llvm.cmake#L39] | `ON` | Enable if LLVM was build with RTTI enabled | | -| (`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. | || (`ENABLE_HDFS`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/hdfs3.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable HDFS | | -| (`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) | || (`ENABLE_GSASL_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/libgsasl.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable gsasl library | | -| (`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 | | -| (`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 | || (`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 | || (`ENABLE_RDKAFKA`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/rdkafka.cmake#L2] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable kafka | | -| (`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 | || (`ENABLE_ORC`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/orc.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable ORC | | -| (`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) | || (`ENABLE_CASSANDRA`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/cassandra.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable Cassandra | || (`ENABLE_S3`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/s3.cmake#L1] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable S3 | | -| (`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) | || (`ENABLE_RAPIDJSON`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/rapidjson.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Use rapidjson | | -| (`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 | || (`USE_INTERNAL_POCO_LIBRARY`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/poco.cmake#L0] | `ON` | Use internal Poco library | || (`ENABLE_GRPC`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/grpc.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Use gRPC | | -| (`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) | || (`ENABLE_PROTOBUF`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/protobuf.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable protobuf | | -| (`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 | || (`ENABLE_CAPNP`)[https://github.com/clickhouse/clickhouse/blob/master/cmake/find/capnp.cmake#L0] | (`ENABLE_LIBRARIES`)[#enable_libraries] | Enable Cap'n Proto | | -| (`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 | || (`ENABLE_MULTITARGET_CODE`)[https://github.com/clickhouse/clickhouse/blob/master/src/Functions/CMakeLists.txt#L117] | `ON` | | | -| (`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). | || (`ENABLE_CLICKHOUSE_ALL`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L8] | `ON` | Enable all tools | | -| (`ENABLE_CLICKHOUSE_BENCHMARK`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L12] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-benchmark | | -| (`ENABLE_CLICKHOUSE_CLIENT`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L10] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-client | | -| (`ENABLE_CLICKHOUSE_COMPRESSOR`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L14] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-compressor | | -| (`ENABLE_CLICKHOUSE_COPIER`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L15] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-copier | | -| (`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 | | -| (`ENABLE_CLICKHOUSE_FORMAT`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L16] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-format | | -| (`ENABLE_CLICKHOUSE_INSTALL`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L21] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-install | | -| (`ENABLE_CLICKHOUSE_INSTALL`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L21] | `OFF` | Enable clickhouse-install | | -| (`ENABLE_CLICKHOUSE_LOCAL`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L11] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-local | | -| (`ENABLE_CLICKHOUSE_OBFUSCATOR`)[https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L17] | (`ENABLE_CLICKHOUSE_ALL`)[#enable_clickhouse_all] | Enable clickhouse-obfuscator | | -| (`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 | | -| (`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 +| [`ADD_GDB_INDEX_FOR_GOLD`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L191) | `OFF` | Add .gdb-index to resulting binaries for gold linker. NOOP if lld is used. | | +| [`ARCH_NATIVE`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L227) | `OFF` | Add -march=native compiler flag | | +| [`CLICKHOUSE_SPLIT_BINARY`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L102) | `OFF` | Make several binaries (clickhouse-server, clickhouse-client etc.) instead of one bundled | | +| [`COMPILER_PIPE`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L215) | `ON` | -pipe compiler option [less /tmp usage, more ram usage] | | +| [`ENABLE_FUZZING`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L120) | `OFF` | Enables fuzzing instrumentation | Enable fuzzy testing using libfuzzer. Implies ${WITH_COVERAGE}. | +| [`ENABLE_IPO`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L63) | `OFF` | Full link time optimization | Need cmake 3.9+. Usually impractical.. See also ENABLE_THINLTO. | +| [`ENABLE_LIBRARIES`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L326) | `ON` | Enable all libraries (Global default switch) | | +| [`ENABLE_TESTS`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L153) | `ON` | | Adds a Google.Test target binary containing unit tests.. | +| [`ENABLE_THINLTO`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L62) | `ON` | | Need cmake 3.9+. Usually impractical.. | +| [`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 | | +| [`GLIBC_COMPATIBILITY`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L158) | `ON` | Enable compatibility with older glibc libraries. | Only for Linux, x86_64.. Implies ${ENABLE_FASTMEMCPY}. | +| [`MAKE_STATIC_LIBRARIES`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L95) | [`USE_STATIC_LIBRARIES`](#use-static-libraries) | Disable to make shared libraries | | +| [`SPLIT_SHARED_LIBRARIES`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L100) | `OFF` | Keep all internal libraries as separate .so files | DEVELOPER ONLY.. Faster linking if turned on.. | +| [`UNBUNDLED`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L155) | `OFF` | Use system libraries instead of ones in contrib/ | | +| [`USE_INCLUDE_WHAT_YOU_USE`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L387) | `OFF` | | https://github.com/include-what-you-use/include-what-you-use. | +| [`USE_STATIC_LIBRARIES`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L94) | `ON` | Disable to use shared libraries | | +| [`WERROR`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L342) | `OFF` | Enable -Werror compiler option | Using system libs can cause a lot of warnings in includes (on macro expansion).. | +| [`WERROR`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L342) | `ON` | Enable -Werror compiler option | Using system libs can cause a lot of warnings in includes (on macro expansion).. | +| [`WITH_COVERAGE`](https://github.com/clickhouse/clickhouse/blob/master/CMakeLists.txt#L119) | `OFF` | | Enable fuzzy testing using libfuzzer. || [`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. | || [`PARALLEL_COMPILE_JOBS`](https://github.com/clickhouse/clickhouse/blob/master/cmake/limit_jobs.cmake#L8) | `""` | Define the maximum number of concurrent compilation jobs | | +| [`PARALLEL_LINK_JOBS`](https://github.com/clickhouse/clickhouse/blob/master/cmake/limit_jobs.cmake#L21) | `""` | Define the maximum number of concurrent link jobs | || [`ENABLE_CLANG_TIDY`](https://github.com/clickhouse/clickhouse/blob/master/cmake/analysis.cmake#L2) | `OFF` | Use 'clang-tidy' static analyzer if present | || [`SANITIZE`](https://github.com/clickhouse/clickhouse/blob/master/cmake/sanitize.cmake#L0) | `""` | Enable sanitizer: address, memory, thread, undefined | || [`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 | || [`FUZZER`](https://github.com/clickhouse/clickhouse/blob/master/cmake/fuzzer.cmake#L0) | `OFF` | Enable fuzzer: libfuzzer | || [`LINKER_NAME`](https://github.com/clickhouse/clickhouse/blob/master/cmake/tools.cmake#L42) | `OFF` | Linker name or full path | || [`ENABLE_SSL`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/ssl.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable ssl | | +| [`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 | || [`ENABLE_GPERF`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/gperf.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Use gperf function hash generator tool | || [`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 | || [`ENABLE_BASE64`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/base64.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable base64 | || [`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] | || [`ENABLE_H3`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/h3.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable H3 | | +| [`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 | || [`ENABLE_OPENCL`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/opencl.cmake#L2) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable OpenCL support | || [`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 | | +| [`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++ | || [`ENABLE_MYSQL`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/mysqlclient.cmake#L1) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable MySQL | | +| [`ENABLE_MYSQL`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/mysqlclient.cmake#L1) | `FALSE` | Enable MySQL | | +| [`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 | || [`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 | || [`USE_SIMDJSON`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/simdjson.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Use simdjson | || [`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 | | +| [`USE_SNAPPY`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/snappy.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable support of snappy library | || [`USE_SENTRY`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/sentry.cmake#L4) | [`ENABLE_LIBRARIES`](#enable-libraries) | Use Sentry | || [`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 | || [`ENABLE_LDAP`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/ldap.cmake#L1) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable LDAP | | +| [`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 | || [`ENABLE_CURL`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/curl.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable curl | | +| [`USE_INTERNAL_CURL`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/curl.cmake#L3) | [`NOT_UNBUNDLED`](#not-unbundled) | Use internal curl library | || [`ENABLE_ODBC`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/odbc.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable ODBC library | | +| [`USE_INTERNAL_ODBC_LIBRARY`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/odbc.cmake#L10) | [`NOT_UNBUNDLED`](#not-unbundled) | Use internal ODBC library | || [`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 | || [`ENABLE_STATS`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/stats.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enalbe StatsLib library | || [`ENABLE_AVRO`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/avro.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable Avro | | +| [`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 | || [`ENABLE_GTEST_LIBRARY`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/gtest.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable gtest library | | +| [`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 | || [`ENABLE_AMQPCPP`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/amqpcpp.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enalbe AMQP-CPP | || [`ENABLE_ICU`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/icu.cmake#L1) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable ICU | | +| [`ENABLE_ICU`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/icu.cmake#L1) | `0` | Enable ICU | | +| [`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 | || [`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 | || [`ENABLE_PARQUET`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/parquet.cmake#L1) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable parquet | | +| [`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 | || [`USE_UNWIND`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/unwind.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable libunwind (better stacktraces) | || [`ENABLE_BROTLI`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/brotli.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable brotli | | +| [`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 | | +| [`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 | || [`ENABLE_MSGPACK`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/msgpack.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable msgpack library | | +| [`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 | || [`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 | | +| [`LLVM_HAS_RTTI`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/llvm.cmake#L39) | `ON` | Enable if LLVM was build with RTTI enabled | | +| [`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. | || [`ENABLE_HDFS`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/hdfs3.cmake#L1) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable HDFS | | +| [`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) | || [`ENABLE_GSASL_LIBRARY`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/libgsasl.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable gsasl library | | +| [`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 | | +| [`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 | || [`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 | || [`ENABLE_RDKAFKA`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/rdkafka.cmake#L2) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable kafka | | +| [`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 | || [`ENABLE_ORC`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/orc.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable ORC | | +| [`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) | || [`ENABLE_CASSANDRA`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/cassandra.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable Cassandra | || [`ENABLE_S3`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/s3.cmake#L1) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable S3 | | +| [`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) | || [`ENABLE_RAPIDJSON`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/rapidjson.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Use rapidjson | | +| [`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 | || [`USE_INTERNAL_POCO_LIBRARY`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/poco.cmake#L0) | `ON` | Use internal Poco library | || [`ENABLE_GRPC`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/grpc.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Use gRPC | | +| [`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) | || [`ENABLE_PROTOBUF`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/protobuf.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable protobuf | | +| [`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 | || [`ENABLE_CAPNP`](https://github.com/clickhouse/clickhouse/blob/master/cmake/find/capnp.cmake#L0) | [`ENABLE_LIBRARIES`](#enable-libraries) | Enable Cap'n Proto | | +| [`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 | || [`ENABLE_MULTITARGET_CODE`](https://github.com/clickhouse/clickhouse/blob/master/src/Functions/CMakeLists.txt#L117) | `ON` | | | +| [`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). | || [`ENABLE_CLICKHOUSE_ALL`](https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L8) | `ON` | Enable all tools | | +| [`ENABLE_CLICKHOUSE_BENCHMARK`](https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L12) | [`ENABLE_CLICKHOUSE_ALL`](#enable-clickhouse-all) | Enable clickhouse-benchmark | | +| [`ENABLE_CLICKHOUSE_CLIENT`](https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L10) | [`ENABLE_CLICKHOUSE_ALL`](#enable-clickhouse-all) | Enable clickhouse-client | | +| [`ENABLE_CLICKHOUSE_COMPRESSOR`](https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L14) | [`ENABLE_CLICKHOUSE_ALL`](#enable-clickhouse-all) | Enable clickhouse-compressor | | +| [`ENABLE_CLICKHOUSE_COPIER`](https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L15) | [`ENABLE_CLICKHOUSE_ALL`](#enable-clickhouse-all) | Enable clickhouse-copier | | +| [`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 | | +| [`ENABLE_CLICKHOUSE_FORMAT`](https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L16) | [`ENABLE_CLICKHOUSE_ALL`](#enable-clickhouse-all) | Enable clickhouse-format | | +| [`ENABLE_CLICKHOUSE_INSTALL`](https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L21) | [`ENABLE_CLICKHOUSE_ALL`](#enable-clickhouse-all) | Enable clickhouse-install | | +| [`ENABLE_CLICKHOUSE_INSTALL`](https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L21) | `OFF` | Enable clickhouse-install | | +| [`ENABLE_CLICKHOUSE_LOCAL`](https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L11) | [`ENABLE_CLICKHOUSE_ALL`](#enable-clickhouse-all) | Enable clickhouse-local | | +| [`ENABLE_CLICKHOUSE_OBFUSCATOR`](https://github.com/clickhouse/clickhouse/blob/master/programs/CMakeLists.txt#L17) | [`ENABLE_CLICKHOUSE_ALL`](#enable-clickhouse-all) | Enable clickhouse-obfuscator | | +| [`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 | | +| [`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. diff --git a/cmake_flags_generator.py b/cmake_flags_generator.py index 7e919934ab1..9b77c91f395 100755 --- a/cmake_flags_generator.py +++ b/cmake_flags_generator.py @@ -13,15 +13,15 @@ footer_file_name: str = "cmake_files_footer.md" ch_master_url: str = "https://github.com/clickhouse/clickhouse/blob/master/" -name_str: str = "(`{name}`)[" + ch_master_url + "{path}#L{line}]" -default_anchor_str: str = "(`{name}`)[#{anchor}]" +name_str: str = "[`{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 + (_name, _description, default) = entity def anchor(t: str) -> str: - return ''.join([i.lower() for i in t if i.isalpha() or i == "_"]) + return "".join(["-" if i == "_" else i.lower() for i in t if i.isalpha() or i == "_"]) if (len(default) == 0): default = "`OFF`" @@ -39,11 +39,11 @@ def build_entity(path: str, entity: Entity, line_comment: Tuple[int, str]) -> st path=path, line=line) + description: str = "".join(_description.split("\n")) + 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: @@ -57,12 +57,12 @@ def process_file(input_name: str) -> List[str]: 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: + for maybe_comment_line in contents_list[n - 1::-1]: + if not re.match("\s*#\s*", maybe_comment_line): break + comment = re.sub("\s*#\s*", "", maybe_comment_line) + ". " + comment + return n, comment matches: Optional[List[Entity]] = re.findall(cmake_option_regex, contents, re.MULTILINE) @@ -78,8 +78,6 @@ def write_file(output: TextIO, in_file_name: str) -> None: 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)