如何递归添加包含目录?
#6601
Replies: 3 comments 9 replies
-
https://xmake.io/api/scripts/builtin-modules/os.html#os-dirs |
Beta Was this translation helpful? Give feedback.
1 reply
-
add_includedirs 里面肯定不会去支持的,这种做法很容易导致头文件搜索顺序混乱,触发各种诡异的问题。 要搞就自己 os.dirs 遍历搞,出问题自己负责。 |
Beta Was this translation helpful? Give feedback.
8 replies
-
已经使用 os.dirs 解决: -- 包含路径 (自定义扩展语法,支持通配符遍历和递归)
local Includedirs = {
".",
"lib/*", -- 遍历添加一级子目录
"lib/**", -- 递归添加所有子目录
}
for _, v in ipairs(Includedirs) do
for _, dir in ipairs(os.dirs(v)) do
add_includedirs(dir)
end
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
我们可以使用如下语法递归添加源文件:
那么是否有一种类似的语法,能够递归添加包含目录呢?
期望的实现方式(类似gitignore, 同时与add_files语法一致):
Beta Was this translation helpful? Give feedback.
All reactions