From 7df7df6ebfecc7e8b92feeb006eb71f498cb7eac Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Thu, 20 Apr 2023 06:59:52 +0800 Subject: [PATCH] Fix system cityhash setup cityhash does not provide any CMake packages, so it cannot be imported with `find_package` or used with the alias `cityhash::cityhash`. To fix that, we need the following: 1. Use `find_library` to find the `cityhash` library. 2. Remove the `cityhash::cityhash` alias, and use plain `cityhash` to refer to the library. Signed-off-by: Ruoyu Zhong --- CMakeLists.txt | 2 +- clickhouse/CMakeLists.txt | 2 +- contrib/cityhash/cityhash/CMakeLists.txt | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aed0d85c..44cd36d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,7 +77,7 @@ PROJECT (CLICKHOUSE-CLIENT) ENDIF () IF (WITH_SYSTEM_CITYHASH) - FIND_PACKAGE(cityhash REQUIRED) + FIND_LIBRARY(SYSTEM_CITYHASH NAMES cityhash REQUIRED) ELSE () INCLUDE_DIRECTORIES (contrib/cityhash/cityhash) SUBDIRS (contrib/cityhash/cityhash) diff --git a/clickhouse/CMakeLists.txt b/clickhouse/CMakeLists.txt index 67663ec5..e67ba816 100644 --- a/clickhouse/CMakeLists.txt +++ b/clickhouse/CMakeLists.txt @@ -42,7 +42,7 @@ ADD_LIBRARY (clickhouse-cpp-lib ${clickhouse-cpp-lib-src}) SET_TARGET_PROPERTIES (clickhouse-cpp-lib PROPERTIES LINKER_LANGUAGE CXX) TARGET_LINK_LIBRARIES (clickhouse-cpp-lib absl::int128 - cityhash::cityhash + cityhash lz4::lz4 ) TARGET_INCLUDE_DIRECTORIES (clickhouse-cpp-lib diff --git a/contrib/cityhash/cityhash/CMakeLists.txt b/contrib/cityhash/cityhash/CMakeLists.txt index d1311562..287fd91b 100644 --- a/contrib/cityhash/cityhash/CMakeLists.txt +++ b/contrib/cityhash/cityhash/CMakeLists.txt @@ -3,5 +3,3 @@ ADD_LIBRARY (cityhash STATIC ) set_property(TARGET cityhash PROPERTY POSITION_INDEPENDENT_CODE ON) - -ADD_LIBRARY (cityhash::cityhash ALIAS cityhash)