Added the `CLICKHOUSE_CPP_` prefix for all cmake build options. by german3w1 · Pull Request #360 · ClickHouse/clickhouse-cpp · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: |
cmake \
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-D BUILD_TESTS=ON \
-D CLICKHOUSE_CPP_BUILD_TESTS=ON \
${{matrix.SSL_CMAKE_OPTION}} \
-S ${{github.workspace}} \
-B ${{github.workspace}}/build
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/windows_mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ jobs:
tar

- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON -DCHECK_VERSION=OFF
# -DWITH_OPENSSL=ON was not able to make it work (some strange issues with CA paths, need debug)
# -DCHECK_VERSION=OFF since it requires git, which can't be found from within cmake for some reason.
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCLICKHOUSE_CPP_BUILD_TESTS=ON -DCLICKHOUSE_CPP_CHECK_VERSION=OFF
# -DCLICKHOUSE_CPP_WITH_OPENSSL=ON was not able to make it work (some strange issues with CA paths, need debug)
# -DCLICKHOUSE_CPP_CHECK_VERSION=OFF since it requires git, which can't be found from within cmake for some reason.

- name: Build
run: cmake --build build --config ${{env.BUILD_TYPE}} --target all
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- uses: ilammy/msvc-dev-cmd@v1

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCLICKHOUSE_CPP_BUILD_TESTS=ON

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ script: |
eval "${MATRIX_EVAL}"
mkdir build
cd build
cmake .. -DBUILD_TESTS=ON && make
cmake .. -DCLICKHOUSE_CPP_BUILD_TESTS=ON && make
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./ut/clickhouse-cpp-ut ; fi
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./ut/clickhouse-cpp-ut --gtest_filter=-"Client/*:*Performance*" ; fi
38 changes: 19 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ INCLUDE (subdirs)
INCLUDE (openssl)
INCLUDE (version)

OPTION (BUILD_BENCHMARK "Build benchmark" OFF)
OPTION (BUILD_TESTS "Build tests" OFF)
OPTION (BUILD_SHARED_LIBS "Build shared libs" OFF)
OPTION (WITH_OPENSSL "Use OpenSSL for TLS connections" OFF)
OPTION (WITH_SYSTEM_ABSEIL "Use system ABSEIL" OFF)
OPTION (WITH_SYSTEM_LZ4 "Use system LZ4" OFF)
OPTION (WITH_SYSTEM_CITYHASH "Use system cityhash" OFF)
OPTION (DEBUG_DEPENDENCIES "Print debug info about dependencies duting build" ON)
OPTION (CHECK_VERSION "Check that version number corresponds to git tag, usefull in CI/CD to validate that new version published on GitHub has same version in sources" ON)
OPTION (CLICKHOUSE_CPP_BUILD_BENCHMARK "Build benchmark" OFF)
OPTION (CLICKHOUSE_CPP_BUILD_TESTS "Build tests" OFF)
OPTION (CLICKHOUSE_CPP_BUILD_SHARED_LIBS "Build shared libs" OFF)
OPTION (CLICKHOUSE_CPP_WITH_OPENSSL "Use OpenSSL for TLS connections" OFF)
OPTION (CLICKHOUSE_CPP_WITH_SYSTEM_ABSEIL "Use system ABSEIL" OFF)
OPTION (CLICKHOUSE_CPP_WITH_SYSTEM_LZ4 "Use system LZ4" OFF)
OPTION (CLICKHOUSE_CPP_WITH_SYSTEM_CITYHASH "Use system cityhash" OFF)
OPTION (CLICKHOUSE_CPP_DEBUG_DEPENDENCIES "Print debug info about dependencies duting build" ON)
OPTION (CLICKHOUSE_CPP_CHECK_VERSION "Check that version number corresponds to git tag, usefull in CI/CD to validate that new version published on GitHub has same version in sources" ON)

PROJECT (CLICKHOUSE-CLIENT
VERSION "${CLICKHOUSE_CPP_VERSION}"
Expand All @@ -25,7 +25,7 @@ PROJECT (CLICKHOUSE-CLIENT
USE_CXX17 ()
USE_OPENSSL ()

IF (CHECK_VERSION)
IF (CLICKHOUSE_CPP_CHECK_VERSION)
clickhouse_cpp_check_library_version(FATAL_ERROR)
ENDIF ()

Expand All @@ -44,7 +44,7 @@ IF (UNIX)
ENDIF ()

IF (APPLE OR MSVC)
IF(BUILD_SHARED_LIBS)
IF(CLICKHOUSE_CPP_BUILD_SHARED_LIBS)
MESSAGE(FATAL "Does not support shared on this platform")
ENDIF()
ENDIF()
Expand Down Expand Up @@ -72,21 +72,21 @@ IF (CLANG_WITH_LIB_STDCXX)
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcc_s")
ENDIF ()

IF (WITH_SYSTEM_ABSEIL)
IF (CLICKHOUSE_CPP_WITH_SYSTEM_ABSEIL)
FIND_PACKAGE(absl REQUIRED)
ELSE ()
INCLUDE_DIRECTORIES (contrib/absl)
SUBDIRS (contrib/absl/absl)
ENDIF ()

IF (WITH_SYSTEM_LZ4)
IF (CLICKHOUSE_CPP_WITH_SYSTEM_LZ4)
FIND_PACKAGE(lz4 REQUIRED)
ELSE ()
INCLUDE_DIRECTORIES (contrib/lz4/lz4)
SUBDIRS (contrib/lz4/lz4)
ENDIF ()

IF (WITH_SYSTEM_CITYHASH)
IF (CLICKHOUSE_CPP_WITH_SYSTEM_CITYHASH)
FIND_PACKAGE(cityhash REQUIRED)
ELSE ()
INCLUDE_DIRECTORIES (contrib/cityhash/cityhash)
Expand All @@ -97,20 +97,20 @@ SUBDIRS (
clickhouse
)

IF (BUILD_BENCHMARK)
IF (CLICKHOUSE_CPP_BUILD_BENCHMARK)
SUBDIRS (bench)
ENDIF (BUILD_BENCHMARK)
ENDIF (CLICKHOUSE_CPP_BUILD_BENCHMARK)

IF (BUILD_TESTS)
IF (CLICKHOUSE_CPP_BUILD_TESTS)
INCLUDE_DIRECTORIES (contrib/gtest/include contrib/gtest)
SUBDIRS (
contrib/gtest
tests/simple
ut
)
ENDIF (BUILD_TESTS)
ENDIF (CLICKHOUSE_CPP_BUILD_TESTS)

if(DEBUG_DEPENDENCIES)
if(CLICKHOUSE_CPP_DEBUG_DEPENDENCIES)
function(print_target_properties target)
MESSAGE("${target} properties:")
set(properties "${ARGN}")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Optional dependencies:
```sh
$ mkdir build .
$ cd build
$ cmake .. [-DBUILD_TESTS=ON]
$ cmake .. [-DCLICKHOUSE_CPP_BUILD_TESTS=ON]
$ make
```

Expand Down
6 changes: 3 additions & 3 deletions clickhouse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ else()
endif()
endif()

IF (WITH_OPENSSL)
IF (CLICKHOUSE_CPP_WITH_OPENSSL)
LIST(APPEND clickhouse-cpp-lib-src base/sslsocket.cpp)
ENDIF ()

Expand All @@ -118,7 +118,7 @@ TARGET_INCLUDE_DIRECTORIES (clickhouse-cpp-lib
PUBLIC ${PROJECT_SOURCE_DIR}
)

IF (NOT BUILD_SHARED_LIBS)
IF (NOT CLICKHOUSE_CPP_BUILD_SHARED_LIBS)
ADD_LIBRARY (clickhouse-cpp-lib-static ALIAS clickhouse-cpp-lib)
ELSE ()
SET_TARGET_PROPERTIES (clickhouse-cpp-lib
Expand Down Expand Up @@ -206,7 +206,7 @@ INSTALL(FILES columns/uuid.h DESTINATION include/clickhouse/columns/)
INSTALL(FILES types/type_parser.h DESTINATION include/clickhouse/types/)
INSTALL(FILES types/types.h DESTINATION include/clickhouse/types/)

IF (WITH_OPENSSL)
IF (CLICKHOUSE_CPP_WITH_OPENSSL)
TARGET_LINK_LIBRARIES (clickhouse-cpp-lib OpenSSL::SSL)
ENDIF ()

Expand Down
8 changes: 4 additions & 4 deletions clickhouse/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <vector>
#include <sstream>

#if defined(WITH_OPENSSL)
#if defined(CLICKHOUSE_CPP_WITH_OPENSSL)
#include "base/sslsocket.h"
#endif

Expand Down Expand Up @@ -71,7 +71,7 @@ std::ostream& operator<<(std::ostream& os, const ClientOptions& opt) {
<< " retry_timeout:" << opt.retry_timeout.count()
<< " compression_method:"
<< (opt.compression_method == CompressionMethod::LZ4 ? "LZ4" : "None");
#if defined(WITH_OPENSSL)
#if defined(CLICKHOUSE_CPP_WITH_OPENSSL)
if (opt.ssl_options) {
const auto & ssl_options = *opt.ssl_options;
os << " SSL ("
Expand All @@ -91,7 +91,7 @@ std::ostream& operator<<(std::ostream& os, const ClientOptions& opt) {

ClientOptions& ClientOptions::SetSSLOptions(ClientOptions::SSLOptions options)
{
#ifdef WITH_OPENSSL
#ifdef CLICKHOUSE_CPP_WITH_OPENSSL
ssl_options = options;
return *this;
#else
Expand All @@ -104,7 +104,7 @@ namespace {

std::unique_ptr<SocketFactory> GetSocketFactory(const ClientOptions& opts) {
(void)opts;
#if defined(WITH_OPENSSL)
#if defined(CLICKHOUSE_CPP_WITH_OPENSSL)
if (opts.ssl_options)
return std::make_unique<SSLSocketFactory>(opts);
else
Expand Down
4 changes: 2 additions & 2 deletions cmake/openssl.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
MACRO (USE_OPENSSL)

IF (WITH_OPENSSL)
IF (CLICKHOUSE_CPP_WITH_OPENSSL)
FIND_PACKAGE (OpenSSL REQUIRED)
ADD_COMPILE_DEFINITIONS (WITH_OPENSSL=1)
ADD_COMPILE_DEFINITIONS (CLICKHOUSE_CPP_WITH_OPENSSL=1)
ENDIF ()

ENDMACRO ()
2 changes: 1 addition & 1 deletion ut/CMakeLists.txt