Search code examples
qtffmpegqt-creatorqmake

How to ask QtCreator to use a custom build library on user path instead of using system library


My Ubuntu has ffmpeg library in /usr/lib/x86_64-linux-gnu. I also rebuild ffmpeg from source and install it into my home directory. In project file, I have added following lines:

TARGET = testFFmpeg
INCLUDEPATH += /home/kiet/ffmpeg/include
LIBS += -L/home/kiet/ffmpeg/lib/ -lavcodec -lavformat -lavutil -lswscale

I build my project successfully. But my binary file still links to ffmpeg in /usr/lib/x86_64-linux-gnu

ldd testFFmpeg | grep libav

libavcodec-ffmpeg.so.56 => /usr/lib/x86_64-linux-gnu/libavcodec-ffmpeg.so.56 (0x00007f9085ce7000)
libavformat-ffmpeg.so.56 => /usr/lib/x86_64-linux-gnu/libavformat-ffmpeg.so.56 (0x00007f90858e9000)
libavutil-ffmpeg.so.54 => /usr/lib/x86_64-linux-gnu/libavutil-ffmpeg.so.54 (0x00007f908567a000)

How can I ask qmake to find library in my folder first?


Solution

  • How can I ask qmake to find library in my folder first ?

    Operator += adds the item to the end of the list, but you need to put it at the head of the list like this:

    LIBS = stuff $$LIBS