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
2020-09-18 13:09:22 +00:00
Developer only! This command will likely fulfill most of your needs. Run before calling `ninja` .
2020-09-17 15:09:59 +00:00
2020-09-17 15:46:55 +00:00
```cmake
2020-09-17 16:27:51 +00:00
cmake .. \
-DCMAKE_C_COMPILER=/bin/clang-10 \
-DCMAKE_CXX_COMPILER=/bin/clang++-10 \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_CLICKHOUSE_ALL=OFF \
-DENABLE_CLICKHOUSE_SERVER=ON \
-DENABLE_CLICKHOUSE_CLIENT=ON \
-DUSE_STATIC_LIBRARIES=OFF \
-DSPLIT_SHARED_LIBRARIES=ON \
-DENABLE_LIBRARIES=OFF \
2020-10-12 14:42:19 +00:00
-DUSE_UNWIND=ON \
2020-09-17 16:27:51 +00:00
-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*` ).
3. Libraries finders (search for contrib libraries, located in `/cmake/find` ).
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.