2020-09-17 15:09:59 +00:00
# CMake in ClickHouse
2020-09-10 15:57:18 +00:00
2020-09-17 15:09:59 +00:00
## TL; DR How to make ClickHouse compile and link faster?
2020-09-10 15:57:18 +00:00
2021-06-24 13:52:08 +00:00
Minimal ClickHouse build example:
2020-09-17 15:09:59 +00:00
2021-06-24 13:52:08 +00:00
```bash
2020-09-17 16:27:51 +00:00
cmake .. \
2022-02-19 17:43:02 +00:00
-DCMAKE_C_COMPILER=$(which clang-14) \
-DCMAKE_CXX_COMPILER=$(which clang++-14) \
2020-09-17 16:27:51 +00:00
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_UTILS=OFF \
2020-09-17 15:09:59 +00:00
-DENABLE_TESTS=OFF
```
## CMake files types
1. ClickHouse's source CMake files (located in the root directory and in `/src` ).
2. Arch-dependent CMake files (located in `/cmake/*os_name*` ).
2022-01-31 07:28:27 +00:00
3. Libraries finders (search for contrib libraries, located in `/contrib/*/CMakeLists.txt` ).
2020-09-17 15:09:59 +00:00
3. Contrib build CMake files (used instead of libraries' own CMake files, located in `/cmake/modules` )
2020-09-10 15:57:18 +00:00
## List of CMake flags
2020-09-19 17:31:41 +00:00
* This list is auto-generated by [this Python script ](https://github.com/clickhouse/clickhouse/blob/master/docs/tools/cmake_in_clickhouse_generator.py ).
2020-09-10 15:57:18 +00:00
* The flag name is a link to its position in the code.
2020-09-18 13:09:22 +00:00
* If an option's default value is itself an option, it's also a link to its position in this list.