ClickHouse / clickhouse-cpp

C++ client library for ClickHouse
Apache License 2.0
305 stars 159 forks source link

New CMake option - CHCPP_EMBEDDED_BUILD #385

Closed AndreyAlifanov closed 2 months ago

AndreyAlifanov commented 2 months ago

We need ability to build clickhouse-cpp as part of our product. But CMakeLists.txt uses global options, sush as BUILD_SHARED_LIBS, BUILD_TESTS and so on. This breaks our build system.

So I made new flag - CHCPP_EMBEDDED_BUILD. If external code sets this flag (in upper CMakeLists.txt, for example), global options are not changed by clickhouse-cpp.

By default, CHCPP_EMBEDDED_BUILD is not set, so it doesn't affect default behavior.

Usage example. In this example flags touch only clickhouse-cpp, and don't affect our projects.

set (CHCPP_EMBEDDED_BUILD ON)
set (BUILD_SHARED_LIBS OFF)
set (BUILD_BENCHMARK OFF)
set (BUILD_TESTS OFF)
add_subdirectory(clickhouse-cpp)
CLAassistant commented 2 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Andrey Alifanov seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.