| 1 |
# Copyright(C) 2021-2023 Sutou Kouhei <[email protected]> |
| 2 |
# |
| 3 |
# This library is free software; you can redistribute it and/or |
| 4 |
# modify it under the terms of the GNU Lesser General Public |
| 5 |
# License as published by the Free Software Foundation; either |
| 6 |
# version 2.1 of the License, or (at your option) any later version. |
| 7 |
# |
| 8 |
# This library is distributed in the hope that it will be useful, |
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
# Lesser General Public License for more details. |
| 12 |
# |
| 13 |
# You should have received a copy of the GNU Lesser General Public |
| 14 |
# License along with this library; if not, write to the Free Software |
| 15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 16 |
|
| 17 |
if(Groongazstd_FOUND) |
| 18 |
return() |
| 19 |
endif() |
| 20 |
|
| 21 |
set(find_package_args "") |
| 22 |
set(pkg_check_modules_version "") |
| 23 |
if(Groongazstd_FIND_VERSION) |
| 24 |
list(APPEND find_package_args ${Groongazstd_FIND_VERSION}) |
| 25 |
set(pkg_check_modules_version ">=${Groongazstd_FIND_VERSION}") |
| 26 |
endif() |
| 27 |
if(Groongazstd_FIND_QUIETLY) |
| 28 |
list(APPEND find_package_args QUIET) |
| 29 |
endif() |
| 30 |
find_package(zstd ${find_package_args}) |
| 31 |
set(Groongazstd_FOUND ${zstd_FOUND}) |
| 32 |
if(Groongazstd_FOUND) |
| 33 |
set(GRN_ZSTD_TARGET zstd::libzstd_shared) |
| 34 |
return() |
| 35 |
endif() |
| 36 |
|
| 37 |
if(NOT Groongazstd_FOUND) |
| 38 |
find_package(PkgConfig) |
| 39 |
if(PkgConfig_FOUND) |
| 40 |
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18") |
| 41 |
pkg_check_modules(Groongazstd_pkg_libzstd IMPORTED_TARGET |
| 42 |
"libzstd${pkg_check_modules_version}") |
| 43 |
else() |
| 44 |
pkg_check_modules(Groongazstd_pkg_libzstd IMPORTED_TARGET GLOBAL |
| 45 |
"libzstd${pkg_check_modules_version}") |
| 46 |
endif() |
| 47 |
set(Groongazstd_FOUND ${Groongazstd_pkg_libzstd_FOUND}) |
| 48 |
if(Groongazstd_pkg_libzstd_FOUND) |
| 49 |
set(GRN_ZSTD_TARGET PkgConfig::Groongazstd_pkg_libzstd) |
| 50 |
endif() |
| 51 |
endif() |
| 52 |
endif() |
| 53 |
|
| 54 |
include(FindPackageHandleStandardArgs) |
| 55 |
find_package_handle_standard_args(Groongazstd REQUIRED_VARS Groongazstd_FOUND) |