CMake FFmpeg Tip

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
Posts: 0
Joined: Sun Nov 07, 2010 11:30 pm
Location: Hamilton, New Zealand

CMake FFmpeg Tip

Post by ldo » Sun Nov 25, 2012 4:09 am

I have FFmpeg built from source on my system, to get around outdated distro packages. I also have a lot of additional functionality enabled, which means my FFmpeg libraries depend on a whole bunch of additional libraries like faac and faad, lame, schrödinger, theora and so on.

My first thought was to add these extra libraries to the CMAKE_EXE_LINKER_FLAGS variable. This is not the place, because the expansion of this variable is included at the wrong point in the final link command, where they will not be used to resolve undefined symbols in the FFmpeg libraries. As a result, your link will fail.

To ensure these libraries are included at the right place, put them on the end of the FFMPEG_LIBRARIES value, after the FFmpeg libraries proper. They will similarly be included immediately after the FFmpeg libraries in the link command, thereby correctly resolving the necessary symbols.

For example, my FFMPEG_LIBRARIES definition currently looks like this (all on one line):

Code: Select all

Everything up to and including “postproc” is an FFmpeg library; everything after that is a non-FFmpeg library needed to resolve dependencies in the FFmpeg libraries.

Post Reply