Skip to content

Commit cb22c08

Browse files
author
Clement Champetier
committed
CMake: fix build with dependency to libav
Check if FFmpeg or libav dependency, and define variable to manage includes in source code.
1 parent 7373f56 commit cb22c08

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ set(FFMPEG_INCLUDE_DIR "/path/to/ffmpeg/include/" CACHE STRING "")
1111
set(FFMPEG_LIBRARY_DIR "/path/to/ffmpeg/lib/" CACHE STRING "")
1212
file(GLOB_RECURSE FFMPEG_LIBS "${FFMPEG_LIBRARY_DIR}/*.so")
1313

14+
# Check if FFmpeg or libav dependency
15+
if(EXISTS "${FFMPEG_INCLUDE_DIR}/libavresample/avresample.h")
16+
add_definitions(-DAV_RESAMPLE_LIBRARY=1)
17+
else()
18+
add_definitions(-DFF_RESAMPLE_LIBRARY=1)
19+
endif()
20+
1421
# Include AvTranscoder and FFmpeg
1522
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${FFMPEG_INCLUDE_DIR})
1623

0 commit comments

Comments
 (0)