I need to use vp8 encoder in my c++ project. I have compiled ffmpeg enabling libvpx library using
./configure --enable-libvpx
how do I add it to CmakeLists.txt. I got linking errors when I linked with
target_link_libraries(main "/path/to/libav")
I need to use vp8 encoder in my c++ project. I have compiled ffmpeg enabling libvpx library using
./configure --enable-libvpx
how do I add it to CmakeLists.txt. I got linking errors when I linked with
target_link_libraries(main "/path/to/libav")
Copyright © 2021 Jogjafile Inc.
Using target_link_libraries
target_link_librariesexpects a full path to a library file, so instead of callingyou should do
Using
target_link_directoriesandtarget_link_librariesYou can explicitly provide directories, where the linker will look for your libraries. Combining this with
target_link_libraries, you getUsing pkg-config
FFmpeg generates pkg-config file, which is a handy solution to handle dependencies. CMake has a module, which supports pkg-config: FindPkgConfig
It provides a function
pkg_check_modules, which searches for a .pc file for your library. Supposed you have a file lib.pc you should callYou can now link with a library by using specific variables set by pkg-config:
Don't forget to check whether your library was actually found: