Skip to content

Commit

Permalink
Fix system cityhash setup
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ZhongRuoyu committed Apr 19, 2023
1 parent 5a140ad commit 7df7df6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion clickhouse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions contrib/cityhash/cityhash/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ ADD_LIBRARY (cityhash STATIC
)

set_property(TARGET cityhash PROPERTY POSITION_INDEPENDENT_CODE ON)

ADD_LIBRARY (cityhash::cityhash ALIAS cityhash)

0 comments on commit 7df7df6

Please sign in to comment.