Given
The file /usr/lib/gstreamer-0.10/libgstffmpeg.so
is present
Making changes in CMakeLists.txt
Approach 1 find_library()
find_library(GST_FFMPEG NAMES gstffmpeg PATHS /usr/lib/gstreamer-0.10/ )
...
target_link_libraries( MyLibraryOrMyExecutable ${GST_FFMPEG} )
When I run make
with above configuration(approach 1), I get the following errors
/bin/ld: warning: libvpx.so.1, needed by /usr/lib/i386-linux-gnu/libavcodec.so.53, not found (try using -rpath or -rpath-link)
/bin/ld: warning: libschroedinger-1.0.so.0, needed by /usr/lib/i386-linux-gnu/libavcodec.so.53, not found (try using -rpath or -rpath-link)
/bin/ld: warning: libgsm.so.1, needed by /usr/lib/i386-linux-gnu/libavcodec.so.53, not found (try using -rpath or -rpath-link)
Looks like the added library depends on more libraries which are not linked! I can see above 3 .so files in /usr/lib. So one possible solution to approach 1 could be to add three more find_library()
functions. right ?
May be not- This question explores the issues found in above possible solution
- Q1. Is there any other method which saves the effort of finding the dependent libraries and linking them ? An approach using which all the dependent libraries get automatically linked ?
Approach 2 link_directories()
link_directories(/usr/lib/gstreamer-0.10/)
target_link_libraries( MyLibraryOrMyExecutable gstffmpeg )
When I run make
with above configuration(approach 2), I get the following errors
bin/ld: cannot find -lgstffmpeg
- Q2. How to solve the issue with above approach 2?
- Q3. Which approach 1 or 2 is better ?
P.S. Tried reading documentation for cmake and searching on SO but could not resolve my problem. I tried two approaches and have issues with both them