diff options
Diffstat (limited to 'externals/find-modules/Findzstd.cmake')
| -rw-r--r-- | externals/find-modules/Findzstd.cmake | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/externals/find-modules/Findzstd.cmake b/externals/find-modules/Findzstd.cmake index f4031eb70..1c29f3598 100644 --- a/externals/find-modules/Findzstd.cmake +++ b/externals/find-modules/Findzstd.cmake | |||
| @@ -1,19 +1,30 @@ | |||
| 1 | # SPDX-FileCopyrightText: 2022 yuzu Emulator Project | 1 | # SPDX-FileCopyrightText: 2022 yuzu Emulator Project |
| 2 | # SPDX-License-Identifier: GPL-2.0-or-later | 2 | # SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | find_package(PkgConfig) | 4 | include(FindPackageHandleStandardArgs) |
| 5 | 5 | ||
| 6 | if (PKG_CONFIG_FOUND) | 6 | find_package(zstd QUIET CONFIG) |
| 7 | pkg_search_module(libzstd IMPORTED_TARGET GLOBAL libzstd) | 7 | if (zstd_FOUND) |
| 8 | if (libzstd_FOUND) | 8 | find_package_handle_standard_args(zstd CONFIG_MODE) |
| 9 | add_library(zstd::zstd ALIAS PkgConfig::libzstd) | 9 | if (NOT TARGET zstd::zstd) |
| 10 | if (TARGET zstd::libzstd_shared) | ||
| 11 | set_target_properties(zstd::libzstd_shared PROPERTIES IMPORTED_GLOBAL TRUE) | ||
| 12 | add_library(zstd::zstd ALIAS zstd::libzstd_shared) | ||
| 13 | else() | ||
| 14 | set_target_properties(zstd::libzstd_static PROPERTIES IMPORTED_GLOBAL TRUE) | ||
| 15 | add_library(zstd::zstd ALIAS zstd::libzstd_static) | ||
| 16 | endif() | ||
| 17 | endif() | ||
| 18 | else() | ||
| 19 | find_package(PkgConfig QUIET) | ||
| 20 | if (PKG_CONFIG_FOUND) | ||
| 21 | pkg_search_module(libzstd QUIET IMPORTED_TARGET GLOBAL libzstd) | ||
| 22 | if (libzstd_FOUND) | ||
| 23 | add_library(zstd::zstd ALIAS PkgConfig::libzstd) | ||
| 24 | endif() | ||
| 10 | endif() | 25 | endif() |
| 26 | find_package_handle_standard_args(zstd | ||
| 27 | REQUIRED_VARS libzstd_LINK_LIBRARIES | ||
| 28 | VERSION_VAR libzstd_VERSION | ||
| 29 | ) | ||
| 11 | endif() | 30 | endif() |
| 12 | |||
| 13 | include(FindPackageHandleStandardArgs) | ||
| 14 | find_package_handle_standard_args(zstd | ||
| 15 | REQUIRED_VARS | ||
| 16 | libzstd_LINK_LIBRARIES | ||
| 17 | libzstd_FOUND | ||
| 18 | VERSION_VAR libzstd_VERSION | ||
| 19 | ) | ||