summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-07 22:35:49 +0800
committerruki <[email protected]>2022-07-07 22:35:49 +0800
commite8911871580e32e4b782c2bc98ed15248839916f (patch)
treebf9a699ce6685ad8bff48eae03ece9391ad856b2
parentafbbc9a0ed32f096a7e5006edfe042db547807c8 (diff)
improve pcheaderfile
-rw-r--r--xmake/core/base/table.lua5
-rw-r--r--xmake/core/project/target.lua6
2 files changed, 10 insertions, 1 deletions
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua
index 25fc92802..b3e8840e3 100644
--- a/xmake/core/base/table.lua
+++ b/xmake/core/base/table.lua
@@ -494,6 +494,11 @@ function table.remove_if(tbl, pred)
return tbl
end
+-- is empty table?
+function table.empty(tbl)
+ return type(tbl) == "table" and #tbl == 0 and #table.keys(tbl) == 0
+end
+
-- return indices or keys for the given value
function table.find(tbl, value)
local result
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 43df61161..81f79cbae 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -1896,7 +1896,11 @@ end
-- @param langkind c/cxx
--
function _instance:pcheaderfile(langkind)
- return self:get("p" .. langkind .. "header")
+ local pcheaderfile = self:get("p" .. langkind .. "header")
+ if table.empty(pcheaderfile) then
+ pcheaderfile = nil
+ end
+ return pcheaderfile
end
-- get the output of precompiled header file (xxx.h.pch)