Skip to content

Commit bb85459

Browse files
committed
Fix system cityhash setup
cityhash does not provide any CMake packages. Add a `Findcityhash.cmake` script to help find cityhash. Signed-off-by: Ruoyu Zhong <[email protected]>
1 parent 85dae8e commit bb85459

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

cmake/Findcityhash.cmake

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
find_path(cityhash_INCLUDE_DIR
2+
NAMES city.h
3+
DOC "cityhash include directory")
4+
mark_as_advanced(cityhash_INCLUDE_DIR)
5+
find_library(cityhash_LIBRARY
6+
NAMES cityhash libcityhash
7+
DOC "cityhash library")
8+
mark_as_advanced(cityhash_LIBRARY)
9+
10+
# Unlike lz4, cityhash's version information does not seem to be available.
11+
12+
include(FindPackageHandleStandardArgs)
13+
find_package_handle_standard_args(cityhash
14+
REQUIRED_VARS cityhash_LIBRARY cityhash_INCLUDE_DIR)
15+
16+
if (cityhash_FOUND)
17+
set(cityhash_INCLUDE_DIRS "${cityhash_INCLUDE_DIR}")
18+
set(cityhash_LIBRARIES "${cityhash_LIBRARY}")
19+
20+
if (NOT TARGET cityhash::cityhash)
21+
add_library(cityhash::cityhash UNKNOWN IMPORTED)
22+
set_target_properties(cityhash::cityhash PROPERTIES
23+
IMPORTED_LOCATION "${cityhash_LIBRARY}"
24+
INTERFACE_INCLUDE_DIRECTORIES "${cityhash_INCLUDE_DIR}")
25+
endif ()
26+
endif ()

0 commit comments

Comments
 (0)