|
1 | 1 | # Finds or fetches emhash. |
2 | | -if(DEFINED SYCL_EMHASH_DIR OR DEFINED EMHASH_SYS_LOC) |
| 2 | +if(TARGET emhash::emhash) |
3 | 3 | return() |
4 | 4 | endif() |
5 | | -find_file(EMHASH_SYS_LOC "hash_table8.hpp" PATH_SUFFIXES "emhash") |
6 | | -if(NOT EMHASH_SYS_LOC) |
| 5 | +find_package(emhash QUIET) |
| 6 | +if(NOT emhash_FOUND) |
7 | 7 | set(EMHASH_REPO https://github.com/ktprime/emhash) |
8 | 8 | message(STATUS "Will fetch emhash from ${EMHASH_REPO}") |
9 | 9 | include(FetchContent) |
10 | 10 | FetchContent_Declare(emhash |
11 | 11 | GIT_REPOSITORY ${EMHASH_REPO} |
12 | | - GIT_TAG 3ba9abdfdc2e0430fcc2fd8993cad31945b6a02b |
| 12 | + GIT_TAG 09fb0439de0c65e387498232c89d561ee95fbd60 |
13 | 13 | SOURCE_SUBDIR emhash |
14 | 14 | ) |
15 | 15 | FetchContent_MakeAvailable(emhash) |
16 | 16 |
|
17 | | - # FetchContent downloads the files into a directory with |
18 | | - # '-src' as the suffix and emhash has the headers in the |
19 | | - # top level directory in the repo, so copy the headers to a directory |
20 | | - # named `emhash` so source files can include with <emhash/header.hpp> |
21 | | - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include/emhash) |
22 | | - file(GLOB HEADERS "${emhash_SOURCE_DIR}/*.h*") |
23 | | - file(COPY ${HEADERS} DESTINATION ${CMAKE_BINARY_DIR}/include/emhash) |
24 | | - set(SYCL_EMHASH_DIR ${CMAKE_BINARY_DIR}/include/ CACHE INTERNAL "") |
| 17 | + # The official cmake install target uses the 'emhash' namespace, |
| 18 | + # so emulate that here so client code can use a single target name for both cases. |
| 19 | + add_library(emhash INTERFACE) |
| 20 | + target_include_directories(emhash SYSTEM INTERFACE ${emhash_SOURCE_DIR}) |
| 21 | + add_library(emhash::emhash ALIAS emhash) |
25 | 22 | endif() |
0 commit comments