From 94db174b25b69dbfe2d7be98b5ee4644d6b5bf94 Mon Sep 17 00:00:00 2001 From: Itms Date: Sat, 25 Nov 2017 16:56:56 +0000 Subject: [PATCH] Fix the pkgconfig premake module when headers are force-included. This fixes a bug with premake5 happening when using --with-system-mozjs38. Tested By: temple Differential Revision: https://code.wildfiregames.com/D1028 This was SVN commit r20523. --- build/premake/pkgconfig/pkgconfig.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build/premake/pkgconfig/pkgconfig.lua b/build/premake/pkgconfig/pkgconfig.lua index 0b6b1d3e17..85a9f76af2 100644 --- a/build/premake/pkgconfig/pkgconfig.lua +++ b/build/premake/pkgconfig/pkgconfig.lua @@ -13,17 +13,25 @@ function m.add_includes(lib, alternative_cmd) result = os_capture(alternative_cmd) end + -- Small trick: delete the space after -include so that we can detect + -- which files have to be force-included without difficulty. + result = result:gsub("%-include +(%g+)", "-include%1") + local dirs = {} + local files = {} local options = {} for w in string.gmatch(result, "[^' ']+") do if string.sub(w,1,2) == "-I" then table.insert(dirs, string.sub(w,3)) + elseif string.sub(w,1,8) == "-include" then + table.insert(files, string.sub(w,9)) else table.insert(options, w) end end sysincludedirs(dirs) + forceincludes(files) buildoptions(options) end