From 7fb102ed45d83e9f0a737cdf336bdc5b7f4194a9 Mon Sep 17 00:00:00 2001
From: Amin Bandali <amin.bandali@savoirfairelinux.com>
Date: Mon, 3 Oct 2022 14:28:56 -0400
Subject: [PATCH] build: Tweak CMakeLists.txt pkg-config usage for finding
 avutil.

* CMakeLists.txt: Prepend CMAKE_PREFIX_PATH with the location of
libavutil.pc from daemon's contrib before trying to find libavutil
using pkg-config, and remove it afterwards.  Further, there is no need
to link the application executable against libavutil; the application
only needs its headers (libclient, however, does already link against
libavutil).

Change-Id: Iffa5af43bfd1bb62bc24cc94dce292f87e9ecb2a
---
 CMakeLists.txt | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e7527c64e..f105bb5fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -361,7 +361,12 @@ elseif (NOT APPLE)
   endif()
 
   pkg_check_modules(XCB xcb)
+
+  list(PREPEND CMAKE_PREFIX_PATH
+    ${LIBJAMI_CONTRIB_DIR}/native/ffmpeg/libavutil)
   pkg_check_modules(LIBAVUTIL libavutil>=55.75.100)
+  list(REMOVE_ITEM CMAKE_PREFIX_PATH
+    ${LIBJAMI_CONTRIB_DIR}/native/ffmpeg/libavutil)
 
   include_directories(
     ${LIBCLIENT_SRC_DIR}
@@ -557,8 +562,7 @@ elseif (NOT APPLE)
     ${LIBGDKPIXBUF_LIBRARIES}
     ${GLIB_LIBRARIES}
     ${GIO_LIBRARIES}
-    ${XCB_LIBRARIES}
-    ${LIBAVUTIL_LIBRARIES})
+    ${XCB_LIBRARIES})
 
   # Installation rules
   install(
-- 
GitLab