Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zstd finder file #165

Merged
merged 1 commit into from
Sep 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ()
Loading