Merge pull request #19498 from brad0/ffmpeg_cmake

ffmpeg: Fix the HAVE_LIBAVCODEC_CONST_AVCODEC test
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2024-09-28 11:35:37 +02:00
commit eb4bc23460
1 file changed
+3 -2
+3 -2
View File
@@ -988,7 +988,8 @@ if(USE_FFMPEG)
find_package(FFmpeg REQUIRED avcodec avformat avutil swresample swscale)
# Check if we need to use avcodec_(alloc|free)_frame instead of av_frame_(alloc|free)
# Check if we need to use const AVCodec
set(CMAKE_REQUIRED_LIBRARIES avcodec;avformat)
set(CMAKE_REQUIRED_INCLUDES ${FFmpeg_INCLUDE_avcodec} ${FFmpeg_INCLUDE_avformat})
set(CMAKE_REQUIRED_LIBRARIES FFmpeg::avcodec;FFmpeg::avformat)
set(CMAKE_REQUIRED_FLAGS "-pedantic -Wall -Werror -Wno-unused-variable")
check_cxx_source_compiles("extern \"C\" {
#include <libavcodec/avcodec.h>
@@ -2449,7 +2450,7 @@ if(FFmpeg_FOUND)
target_compile_definitions(${CoreLibName} PRIVATE HAVE_LIBAVCODEC_CONST_AVCODEC=1)
endif()
set_target_properties(${CoreLibName} PROPERTIES NO_SYSTEM_FROM_IMPORTED true)
target_include_directories(${CoreLibName} BEFORE PUBLIC ${FFmpeg_INCLUDE_avcodec})
target_include_directories(${CoreLibName} BEFORE PUBLIC ${FFmpeg_INCLUDE_avcodec} ${FFmpeg_INCLUDE_avformat})
target_link_libraries(${CoreLibName}
FFmpeg::avcodec
FFmpeg::avformat