mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-18 01:14:56 +00:00
cmake: prefer system ffmpeg library (#451)
This commit is contained in:
parent
c1fb5d5bca
commit
ad60ae1d40
3 changed files with 27 additions and 2 deletions
23
cmake/FindFFmpeg.cmake
Normal file
23
cmake/FindFFmpeg.cmake
Normal file
|
@ -0,0 +1,23 @@
|
|||
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(FFMPEG QUIET IMPORTED_TARGET libavcodec libavfilter libavformat libavutil libswresample libswscale)
|
||||
|
||||
find_file(FFMPEG_VERSION_FILE libavutil/ffversion.h HINTS "${FFMPEG_libavutil_INCLUDEDIR}")
|
||||
if (FFMPEG_VERSION_FILE)
|
||||
file(STRINGS "${FFMPEG_VERSION_FILE}" FFMPEG_VERSION_LINE REGEX "FFMPEG_VERSION")
|
||||
string(REGEX MATCH "[0-9.]+" FFMPEG_VERSION "${FFMPEG_VERSION_LINE}")
|
||||
unset(FFMPEG_VERSION_LINE)
|
||||
unset(FFMPEG_VERSION_FILE)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(FFmpeg
|
||||
REQUIRED_VARS FFMPEG_LINK_LIBRARIES
|
||||
VERSION_VAR FFMPEG_VERSION
|
||||
)
|
||||
|
||||
if (FFmpeg_FOUND AND NOT TARGET FFmpeg::ffmpeg)
|
||||
add_library(FFmpeg::ffmpeg ALIAS PkgConfig::FFMPEG)
|
||||
endif()
|
Loading…
Add table
Add a link
Reference in a new issue