Skip to content

Commit

Permalink
Add zstd finder file (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
peddie committed Sep 3, 2023
1 parent e186d6c commit 48d4af0
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Findzstd.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
if (TARGET zstd::zstd)
return()
endif()

include(FindPackageHandleStandardArgs)

if (APPLE)
file(GLOB ZSTD_DIRS
/usr/local/Cellar/zstd/*
/opt/homebrew/Cellar/zstd/*
)
endif()

find_path(zstd_INCLUDE_DIR
NAMES zstd.h
HINTS ${ZSTD_DIRS}
PATH_SUFFIXES include
)

find_library(zstd_LIBRARY
NAMES zstd
HINTS ${ZSTD_DIRS}
PATH_SUFFIXES lib
)

find_package_handle_standard_args(zstd REQUIRED_VARS
zstd_LIBRARY
zstd_INCLUDE_DIR
)

if (zstd_FOUND)
mark_as_advanced(zstd_LIBRARY)
mark_as_advanced(zstd_INCLUDE_DIR)

add_library(zstd::zstd UNKNOWN IMPORTED)
set_target_properties(zstd::zstd
PROPERTIES
IMPORTED_LOCATION ${zstd_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${zstd_INCLUDE_DIR}
)
endif ()

0 comments on commit 48d4af0

Please sign in to comment.