Skip to content

Commit

Permalink
CMake: Add xxhash pkg-config fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt committed Dec 18, 2024
1 parent 8493dc0 commit 3773127
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ if(LSQPACK_XXH)
set(LSQPACK_DEPENDS "")
else()
find_package(xxHash CONFIG REQUIRED)
if(NOT xxHash_FOUND)
find_package(PkgConfig REQUIRED)
pkg_check_modules(XXH REQUIRED IMPORTED_TARGET libxxhash)
add(library xxHash::xxhash ALIAS PkgConfig::XXH)
endif()
target_link_libraries(ls-qpack PRIVATE xxHash::xxhash)
set(LSQPACK_DEPENDS "libxxhash")
endif()
Expand Down
7 changes: 6 additions & 1 deletion ls-qpack-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
if(NOT "@BUILD_SHARED_LIBS@" AND NOT "@LSQPACK_XXH@")
include(CMakeFindDependencyMacro)
find_dependency(xxHash CONFIG)
if("@xxHash_FOUND@")
find_dependency(xxHash CONFIG)
else()
find_dependency(PkgConfig)
pkg_check_modules(XXH REQUIRED IMPORTED_TARGET libxxhash)
endif()
endif()
include("${CMAKE_CURRENT_LIST_DIR}/ls-qpack-targets.cmake")

0 comments on commit 3773127

Please sign in to comment.