Skip to content

Commit

Permalink
Try finding cityhash with find_package first
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhongRuoyu committed Apr 25, 2023
1 parent b99d338 commit 945066a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ PROJECT (CLICKHOUSE-CLIENT)
ENDIF ()

IF (WITH_SYSTEM_CITYHASH)
FIND_LIBRARY(SYSTEM_CITYHASH NAMES cityhash REQUIRED)
# Try with FIND_PACKAGE first, as conan and vcpkg provide a CMake
# package for cityhash.
FIND_PACKAGE(cityhash)
IF (NOT cityhash_FOUND)
# Fall back to FIND_LIBRARY, if no CMake package is found.
FIND_LIBRARY(SYSTEM_CITYHASH NAMES cityhash REQUIRED)
ENDIF ()
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 @@ -38,7 +38,7 @@ IF (WITH_OPENSSL)
LIST(APPEND clickhouse-cpp-lib-src base/sslsocket.cpp)
ENDIF ()

IF (WITH_SYSTEM_CITYHASH)
IF (WITH_SYSTEM_CITYHASH AND NOT cityhash_FOUND)
SET (CITYHASH ${SYSTEM_CITYHASH})
ELSE ()
SET (CITYHASH cityhash::cityhash)
Expand Down

0 comments on commit 945066a

Please sign in to comment.