diff options
| author | ruki <[email protected]> | 2022-07-07 22:35:49 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-07-07 22:35:49 +0800 |
| commit | e8911871580e32e4b782c2bc98ed15248839916f (patch) | |
| tree | bf9a699ce6685ad8bff48eae03ece9391ad856b2 | |
| parent | afbbc9a0ed32f096a7e5006edfe042db547807c8 (diff) | |
improve pcheaderfile
| -rw-r--r-- | xmake/core/base/table.lua | 5 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 6 |
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) |
