diff options
Diffstat (limited to 'CMakeModules/Findzstd.cmake')
| -rw-r--r-- | CMakeModules/Findzstd.cmake | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/CMakeModules/Findzstd.cmake b/CMakeModules/Findzstd.cmake new file mode 100644 index 000000000..ae3ea0865 --- /dev/null +++ b/CMakeModules/Findzstd.cmake | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | # SPDX-FileCopyrightText: 2022 yuzu Emulator Project | ||
| 2 | # SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | include(FindPackageHandleStandardArgs) | ||
| 5 | |||
| 6 | find_package(zstd QUIET CONFIG) | ||
| 7 | if (zstd_CONSIDERED_CONFIGS) | ||
| 8 | find_package_handle_standard_args(zstd CONFIG_MODE) | ||
| 9 | else() | ||
| 10 | find_package(PkgConfig QUIET) | ||
| 11 | pkg_search_module(ZSTD QUIET IMPORTED_TARGET libzstd) | ||
| 12 | find_package_handle_standard_args(zstd | ||
| 13 | REQUIRED_VARS ZSTD_LINK_LIBRARIES | ||
| 14 | VERSION_VAR ZSTD_VERSION | ||
| 15 | ) | ||
| 16 | endif() | ||
| 17 | |||
| 18 | if (zstd_FOUND AND NOT TARGET zstd::zstd) | ||
| 19 | if (TARGET zstd::libzstd_shared) | ||
| 20 | add_library(zstd::zstd ALIAS zstd::libzstd_shared) | ||
| 21 | elseif (TARGET zstd::libzstd_static) | ||
| 22 | add_library(zstd::zstd ALIAS zstd::libzstd_static) | ||
| 23 | else() | ||
| 24 | add_library(zstd::zstd ALIAS PkgConfig::ZSTD) | ||
| 25 | endif() | ||
| 26 | endif() | ||