diff options
author | Andrea Pappacoda <andrea@pappacoda.it> | 2022-07-28 16:44:52 +0200 |
---|---|---|
committer | Andrea Pappacoda <andrea@pappacoda.it> | 2022-07-29 22:52:23 +0200 |
commit | 064625ef58d4166b4983119f5389118113505a84 (patch) | |
tree | ddd050f994ffd18edf3e160eb750e6ed06590269 /externals/find-modules/Findlz4.cmake | |
parent | Merge pull request #8665 from liamwhite/github-is-dumb (diff) | |
download | yuzu-064625ef58d4166b4983119f5389118113505a84.tar yuzu-064625ef58d4166b4983119f5389118113505a84.tar.gz yuzu-064625ef58d4166b4983119f5389118113505a84.tar.bz2 yuzu-064625ef58d4166b4983119f5389118113505a84.tar.lz yuzu-064625ef58d4166b4983119f5389118113505a84.tar.xz yuzu-064625ef58d4166b4983119f5389118113505a84.tar.zst yuzu-064625ef58d4166b4983119f5389118113505a84.zip |
Diffstat (limited to '')
-rw-r--r-- | externals/find-modules/Findlz4.cmake | 59 |
1 files changed, 11 insertions, 48 deletions
diff --git a/externals/find-modules/Findlz4.cmake b/externals/find-modules/Findlz4.cmake index 56dcca8f6..13ca5de66 100644 --- a/externals/find-modules/Findlz4.cmake +++ b/externals/find-modules/Findlz4.cmake @@ -1,56 +1,19 @@ -# SPDX-FileCopyrightText: 2020 yuzu Emulator Project +# SPDX-FileCopyrightText: 2022 yuzu Emulator Project # SPDX-License-Identifier: GPL-2.0-or-later -find_package(PkgConfig QUIET) -pkg_check_modules(PC_lz4 QUIET lz4) +find_package(PkgConfig) -find_path(lz4_INCLUDE_DIR - NAMES lz4.h - PATHS ${PC_lz4_INCLUDE_DIRS} -) -find_library(lz4_LIBRARY - NAMES lz4 - PATHS ${PC_lz4_LIBRARY_DIRS} -) - -if(lz4_INCLUDE_DIR) - file(STRINGS "${lz4_INCLUDE_DIR}/lz4.h" _lz4_version_lines - REGEX "#define[ \t]+LZ4_VERSION_(MAJOR|MINOR|RELEASE)") - string(REGEX REPLACE ".*LZ4_VERSION_MAJOR *\([0-9]*\).*" "\\1" _lz4_version_major "${_lz4_version_lines}") - string(REGEX REPLACE ".*LZ4_VERSION_MINOR *\([0-9]*\).*" "\\1" _lz4_version_minor "${_lz4_version_lines}") - string(REGEX REPLACE ".*LZ4_VERSION_RELEASE *\([0-9]*\).*" "\\1" _lz4_version_release "${_lz4_version_lines}") - set(lz4_VERSION "${_lz4_version_major}.${_lz4_version_minor}.${_lz4_version_release}") - unset(_lz4_version_major) - unset(_lz4_version_minor) - unset(_lz4_version_release) - unset(_lz4_version_lines) +if (PKG_CONFIG_FOUND) + pkg_search_module(liblz4 IMPORTED_TARGET GLOBAL liblz4) + if (liblz4_FOUND) + add_library(lz4::lz4 ALIAS PkgConfig::liblz4) + endif() endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(lz4 - FOUND_VAR lz4_FOUND - REQUIRED_VARS - lz4_LIBRARY - lz4_INCLUDE_DIR - VERSION_VAR lz4_VERSION -) - -if(lz4_FOUND) - set(lz4_LIBRARIES ${lz4_LIBRARY}) - set(lz4_INCLUDE_DIRS ${lz4_INCLUDE_DIR}) - set(lz4_DEFINITIONS ${PC_lz4_CFLAGS_OTHER}) -endif() - -if(lz4_FOUND AND NOT TARGET lz4::lz4) - add_library(lz4::lz4 UNKNOWN IMPORTED) - set_target_properties(lz4::lz4 PROPERTIES - IMPORTED_LOCATION "${lz4_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_lz4_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${lz4_INCLUDE_DIR}" - ) -endif() - -mark_as_advanced( - lz4_INCLUDE_DIR - lz4_LIBRARY + REQUIRED_VARS + liblz4_LINK_LIBRARIES + liblz4_FOUND + VERSION_VAR liblz4_VERSION ) |