summaryrefslogtreecommitdiffstats
path: root/externals/find-modules/Findzstd.cmake
diff options
context:
space:
mode:
authorJames Rowe <jroweboy@gmail.com>2020-05-08 23:09:29 +0200
committerGitHub <noreply@github.com>2020-05-08 23:09:29 +0200
commitbc30a591ba7252e0c16d9c1b3c75a7073735bcae (patch)
tree2e88ab16d60c7df3e665bcf7c75c24683cb07189 /externals/find-modules/Findzstd.cmake
parentMerge pull request #3885 from ReinUsesLisp/viewport-swizzles (diff)
downloadyuzu-bc30a591ba7252e0c16d9c1b3c75a7073735bcae.tar
yuzu-bc30a591ba7252e0c16d9c1b3c75a7073735bcae.tar.gz
yuzu-bc30a591ba7252e0c16d9c1b3c75a7073735bcae.tar.bz2
yuzu-bc30a591ba7252e0c16d9c1b3c75a7073735bcae.tar.lz
yuzu-bc30a591ba7252e0c16d9c1b3c75a7073735bcae.tar.xz
yuzu-bc30a591ba7252e0c16d9c1b3c75a7073735bcae.tar.zst
yuzu-bc30a591ba7252e0c16d9c1b3c75a7073735bcae.zip
Diffstat (limited to 'externals/find-modules/Findzstd.cmake')
-rw-r--r--externals/find-modules/Findzstd.cmake41
1 files changed, 41 insertions, 0 deletions
diff --git a/externals/find-modules/Findzstd.cmake b/externals/find-modules/Findzstd.cmake
new file mode 100644
index 000000000..cd0158b0c
--- /dev/null
+++ b/externals/find-modules/Findzstd.cmake
@@ -0,0 +1,41 @@
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_zstd QUIET libzstd)
+
+find_path(zstd_INCLUDE_DIR
+ NAMES zstd.h
+ PATHS ${PC_zstd_INCLUDE_DIRS}
+)
+find_library(zstd_LIBRARY
+ NAMES zstd
+ PATHS ${PC_zstd_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(zstd
+ FOUND_VAR zstd_FOUND
+ REQUIRED_VARS
+ zstd_LIBRARY
+ zstd_INCLUDE_DIR
+ VERSION_VAR zstd_VERSION
+)
+
+if(zstd_FOUND)
+ set(zstd_LIBRARIES ${zstd_LIBRARY})
+ set(zstd_INCLUDE_DIRS ${zstd_INCLUDE_DIR})
+ set(zstd_DEFINITIONS ${PC_zstd_CFLAGS_OTHER})
+endif()
+
+if(zstd_FOUND AND NOT TARGET zstd::zstd)
+ add_library(zstd::zstd UNKNOWN IMPORTED)
+ set_target_properties(zstd::zstd PROPERTIES
+ IMPORTED_LOCATION "${zstd_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${PC_zstd_CFLAGS_OTHER}"
+ INTERFACE_INCLUDE_DIRECTORIES "${zstd_INCLUDE_DIR}"
+ )
+endif()
+
+mark_as_advanced(
+ zstd_INCLUDE_DIR
+ zstd_LIBRARY
+)