diff --git a/modules/GenPkgConfig.cmake b/modules/GenPkgConfig.cmake
index dae7826a337f7c33d5dd942a5e1b7140421cb8ba..78006a16541f3258c9d00b8f3cdaf05e60ef31d9 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()