summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-03-09 23:01:47 +0800
committerruki <[email protected]>2023-03-09 23:01:47 +0800
commitee043df59baa9c496e12e930790e86d1bae22d16 (patch)
tree2216ad9146b93c91f21f9739837c388b0f4f7389
parenta998fe06c24a2e041e6cf44a26437072e9b0c132 (diff)
improve path and moc rule #3457
-rw-r--r--xmake/core/base/path.lua9
-rw-r--r--xmake/rules/qt/moc/xmake.lua4
2 files changed, 10 insertions, 3 deletions
diff --git a/xmake/core/base/path.lua b/xmake/core/base/path.lua
index bd0701702..59c891a3c 100644
--- a/xmake/core/base/path.lua
+++ b/xmake/core/base/path.lua
@@ -65,6 +65,11 @@ function _instance:set(p)
return self
end
+function _instance:empty()
+ local str = self._STR
+ return str == nil or #str == 0
+end
+
function _instance:transform_set(transform)
self._TRANSFORM = transform
self:_update()
@@ -138,12 +143,12 @@ end
-- tostring(path)
function _instance:__tostring()
- return self:str()
+ return not self:empty() and self:str() or ""
end
-- todisplay(path)
function _instance:__todisplay()
- return "<path: " .. self:str() .. ">"
+ return "<path: " .. (self:empty() and "empty" or self:str()) .. ">"
end
-- path.translate:
diff --git a/xmake/rules/qt/moc/xmake.lua b/xmake/rules/qt/moc/xmake.lua
index d520596b6..6290e6395 100644
--- a/xmake/rules/qt/moc/xmake.lua
+++ b/xmake/rules/qt/moc/xmake.lua
@@ -76,7 +76,9 @@ rule("qt.moc")
end
return item
end)
- table.insert(flags, pathitem)
+ if not pathitem:empty() then
+ table.insert(flags, pathitem)
+ end
end
end
local user_flags = target:get("qt.moc.flags") or {}