diff options
| author | James Rowe <jroweboy@gmail.com> | 2020-05-08 15:09:29 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-08 17:09:29 -0400 |
| commit | bc30a591ba7252e0c16d9c1b3c75a7073735bcae (patch) | |
| tree | 2e88ab16d60c7df3e665bcf7c75c24683cb07189 /externals/find-modules/Findlz4.cmake | |
| parent | 50c27d5ae1bfe6cff6f091f07d68ab7b8e394d9d (diff) | |
Replace externals with Conan (#3735)
* Remove git submodules that will be loaded through conan
* Move custom Find modules to their own folder
* Use conan for downloading missing external dependencies
* CI: Change the yuzu source folder user to the user that the containers run on
* Attempt to remove dirty mingw build hack
* Install conan on the msvc build
* Only set release build type when using not using multi config generator
* Re-add qt bundled to workaround an issue with conan qt not downloading prebuilt binaries
* Add workaround for submodules that use legacy CMAKE variables
* Re-add USE_BUNDLED_QT on the msvc build bot
Diffstat (limited to 'externals/find-modules/Findlz4.cmake')
| -rw-r--r-- | externals/find-modules/Findlz4.cmake | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/externals/find-modules/Findlz4.cmake b/externals/find-modules/Findlz4.cmake new file mode 100644 index 000000000..6279854c0 --- /dev/null +++ b/externals/find-modules/Findlz4.cmake @@ -0,0 +1,54 @@ + +find_package(PkgConfig QUIET) +pkg_check_modules(PC_lz4 QUIET lz4) + +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) +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 +) |
