diff options
author | Christophe Giboudeaux <christophe@krop.fr> | 2022-07-20 10:23:46 +0200 |
---|---|---|
committer | Christophe Giboudeaux <christophe@krop.fr> | 2022-07-21 07:37:43 +0200 |
commit | b78f90e31623ece4d041bb2834dc7cd185c2e67b (patch) | |
tree | 8a4109f4eea6428a5adbe96074062f522c256bc2 /cmake | |
parent | 5a210ae22cc6b44cbe6a126a54adf653f47d88b6 (diff) |
FFmpeg: Don't link to private target when building shared libraries
Task-number: QTBUG-102645
Pick-to: 6.4
Change-Id: I9eca70ca28118a344f2d7e021bcfd8baad668a1b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindFFmpeg.cmake | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake index 628c8dfe6..c424c67a0 100644 --- a/cmake/FindFFmpeg.cmake +++ b/cmake/FindFFmpeg.cmake @@ -220,6 +220,12 @@ endfunction() find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h) find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h) + # Linking to private FFmpeg libraries is only needed if it was built statically + # Only one of the components needs to be tested + if(AVCODEC_LIBRARY AND ${AVCODEC_LIBRARY} MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$") + set(__ffmpeg_is_static TRUE) + endif() + # Check if the required components were found and add their stuff to the FFMPEG_* vars. foreach (_component ${FFmpeg_FIND_COMPONENTS}) if (${_component}_FOUND) @@ -241,7 +247,9 @@ endfunction() INTERFACE_LINK_LIBRARIES "${${_component}_LIBRARIES}" INTERFACE_LINK_DIRECTORIES "${${_component}_LIBRARY_DIRS}" ) - __ffmpeg_internal_set_dependencies(${_lowerComponent}) + if(__ffmpeg_is_static) + __ffmpeg_internal_set_dependencies(${_lowerComponent}) + endif() target_link_libraries(FFmpeg::${_lowerComponent} INTERFACE "${${_component}_LIBRARY}") if (UNIX AND NOT APPLE) target_link_options(FFmpeg::${_lowerComponent} INTERFACE "-Wl,--exclude-libs=lib${_lowerComponent}") |