From 852f8c125e6f86b1328e4c32b773ac3bb65cc2ad Mon Sep 17 00:00:00 2001 From: Florent Pruvost <florent.pruvost@inria.fr> Date: Thu, 13 Jun 2024 15:03:31 +0200 Subject: [PATCH] GenPkgConfig.cmake: fix gpc_convert_incstyle_to_pkgconfig with mixed cflags --- modules/GenPkgConfig.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/GenPkgConfig.cmake b/modules/GenPkgConfig.cmake index dae7826..78006a1 100644 --- a/modules/GenPkgConfig.cmake +++ b/modules/GenPkgConfig.cmake @@ -73,9 +73,11 @@ macro(gpc_convert_incstyle_to_pkgconfig _inclist) set(${_inclist}_CPY "${${_inclist}}") set(${_inclist} "") foreach(_dep ${${_inclist}_CPY}) - if (${_dep} MATCHES "^-D") + if (${_dep} MATCHES "^-") + # any compiler flag (e.g. -pthread, -DUSE_FOO): keep as it is list(APPEND ${_inclist} ${_dep}) - else() + elseif (EXISTS ${_dep}) + # an absolute path to includes: add the -I list(APPEND ${_inclist} "-I${_dep}") endif() endforeach() -- GitLab