summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorPiotr Srebrny <piotr.srebrny@qt.io>2021-11-16 13:29:13 +0100
committerLars Knoll <lars.knoll@qt.io>2022-01-19 14:16:19 +0100
commit70654380ed1dd8569fc70a5f4a6e46c8be3ffba6 (patch)
tree2d4b14ce6822023538bd5a81251f541cfd1d0d59 /cmake
parent7bf9178fb72f35d3c8ac77ecbb875aa3701872b3 (diff)
FFmpeg: Provide FFMpeg lib dir with FFMPEG_DIR variable
Change-Id: Idb6c66eaa4ecbca9c8cd764550adabe957d98fea Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindFFmpeg.cmake27
1 files changed, 19 insertions, 8 deletions
diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake
index 6ecbac0e5..75e9112a8 100644
--- a/cmake/FindFFmpeg.cmake
+++ b/cmake/FindFFmpeg.cmake
@@ -92,7 +92,7 @@ macro(find_component _component _pkgconfig _library _header)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
- find_package(PkgConfig)
+ find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_${_component} ${_pkgconfig})
endif ()
@@ -102,21 +102,32 @@ macro(find_component _component _pkgconfig _library _header)
${PC_${_component}_INCLUDEDIR}
${PC_${_component}_INCLUDE_DIRS}
${PC_FFMPEG_INCLUDE_DIRS}
+ PATHS
+ ${FFMPEG_DIR}
PATH_SUFFIXES
- ffmpeg
+ ffmpeg include
)
find_library(${_component}_LIBRARY NAMES ${PC_${_component}_LIBRARIES} ${_library}
- HINTS
+ HINTS
${PC_${_component}_LIBDIR}
${PC_${_component}_LIBRARY_DIRS}
${PC_FFMPEG_LIBRARY_DIRS}
+ PATHS
+ ${FFMPEG_DIR}
+ PATH_SUFFIXES
+ lib
)
- set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.")
- set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.")
- set(${_component}_LIBRARY_DIRS ${PC_${_component}_LIBRARY_DIRS} CACHE STRING "The ${_component} library dirs.")
- set(${_component}_LIBRARIES ${PC_${_component}_LIBRARIES} CACHE STRING "The ${_component} libraries.")
+ get_filename_component(${_component}_LIBRARY_DIR_FROM_FIND ${${_component}_LIBRARY} DIRECTORY)
+ get_filename_component(${_component}_LIBRARY_FROM_FIND ${${_component}_LIBRARY} NAME)
+
+ set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.")
+ set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.")
+ set(${_component}_LIBRARY_DIRS ${${_component}_LIBRARY_DIR_FROM_FIND} CACHE STRING "The ${_component} library dirs.")
+ set(${_component}_LIBRARIES ${${_component}_LIBRARY_FROM_FIND} CACHE STRING "The ${_component} libraries.")
+
+ message("Libs" ${${_component}_LIBRARIES} ${${_component}_LIBRARY_DIRS})
# message(STATUS "L0: ${${_component}_LIBRARIES}")
# message(STATUS "L1: ${PC_${_component}_LIBRARIES}")
@@ -199,7 +210,7 @@ if (NOT TARGET FFmpeg::FFmpeg)
add_library(FFmpeg INTERFACE)
set_target_properties(FFmpeg PROPERTIES
INTERFACE_COMPILE_OPTIONS "${FFMPEG_DEFINITIONS}"
- INTERFACE_INCLUDE_DIRECTORIES ${FFMPEG_INCLUDE_DIRS}
+ INTERFACE_INCLUDE_DIRECTORIES "${FFMPEG_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${FFMPEG_LIBRARIES}"
INTERFACE_LINK_DIRECTORIES "${FFMPEG_LIBRARY_DIRS}")
add_library(FFmpeg::FFmpeg ALIAS FFmpeg)