From 7b5ed13579076445f660caf8632d4e36230590aa Mon Sep 17 00:00:00 2001
From: Florent Pruvost <florent.pruvost@inria.fr>
Date: Fri, 24 Nov 2023 14:17:19 +0100
Subject: [PATCH] GenPkgConfig.cmake: fix -L/opt/foo/lib -lfoo case

---
 modules/GenPkgConfig.cmake | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/GenPkgConfig.cmake b/modules/GenPkgConfig.cmake
index ef8fe04..ddab5b5 100644
--- a/modules/GenPkgConfig.cmake
+++ b/modules/GenPkgConfig.cmake
@@ -108,8 +108,8 @@ macro(gpc_convert_libstyle_to_pkgconfig _liblist)
       endforeach()
       string(REGEX REPLACE "^lib" "" dep_libname "${dep_libname}")
       list(APPEND ${_liblist} -L${dep_libdir} -l${dep_libname})
-    elseif(${_dep} MATCHES "^-l")
-      # case library given with -l (e.g. -lfoo)
+    elseif(${_dep} MATCHES "^-l|^-L")
+      # case library given with -l (e.g. -lfoo) or -L (e.g. -L/opt/foo/lib -lfoo)
       list(APPEND ${_liblist} ${_dep})
     else()
       # case library given by name (e.g. foo)
-- 
GitLab