diff --git a/CMakeLists.txt b/CMakeLists.txt index 44cd36d6..49a73122 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/clickhouse/CMakeLists.txt b/clickhouse/CMakeLists.txt index 9680c164..561c5d8b 100644 --- a/clickhouse/CMakeLists.txt +++ b/clickhouse/CMakeLists.txt @@ -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)