-Wl,-force_link flags not working correctly

I guess that’s because you need both:

  • target_link_libraries(utils_video_encode_decode_ffmpeg PUBLIC avfilter) for the “regular” dependency
  • target_link_libraries(utils_video_encode_decode_ffmpeg PUBLIC "-Wl,-force_load $<TARGET_PROPERTY:avfilter,IMPORTED_LOCATION>") for the “force load”

Putting them together:

target_link_libraries(utils_video_encode_decode_ffmpeg
  PUBLIC
    avfilter
     "-Wl,-force_load $<TARGET_PROPERTY:avfilter,IMPORTED_LOCATION>"
)