-
-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow target:fileconfig() for headerfiles #4831
Comments
Title: Allow target:fileconfig() for header files |
it works for me. and target:fileconfig has only one argument. target("test")
set_kind("binary")
add_files("src/*.cpp", {do_not_format = true})
on_config(function (target)
for _, file in ipairs(target:sourcefiles()) do
local fileconfig = target:fileconfig(file)
print(file, fileconfig)
end
end)
ruki-2:test ruki$ xmake
src/main.cpp {
do_not_format = true
}
[100%]: build ok, spent 0.511s But it only supports add_files now. |
oh, but this issue is about header files target("test")
set_kind("binary")
add_files("source.cpp", {do_not_format = true})
add_headerfiles("header.hpp", {do_not_format = true})
on_config(function (target)
for _, file in ipairs(table.join(target:sourcefiles(), target:headerfiles())) do
local fileconfig = target:fileconfig(file)
print(file, fileconfig)
end
end)
I know, that's why I opened this feature request |
try this patch #4836 xmake update -s github:xmake-io#fileconfig target("test")
set_kind("static")
add_files("src/*.cpp", {do_not_format = true})
add_headerfiles("src/*.h", {do_not_format = true})
on_config(function (target)
print(target:fileconfig("src/main.cpp")) -- add_files
print(target:fileconfig("src/test.h", {filetype = "headerfiles"})) -- add_headerfiles
end) |
I could update with
with the script |
It works for me. Please make sure it has been updated. $xmake
{
do_not_format = true
}
{
do_not_format = true
} |
Sorry, my header was |
I have merged this patch and fix some issues. |
Is your feature request related to a problem? Please describe.
I have a custom rule that calls clang-format on my code on before_build, but I wish for some files not to be auto-formatted. I added a config like so:
but when the rule runs, fileconfig always returns nil for headers
Describe the solution you'd like
I would like for target:fileconfig() to return the configuration specified when calling add_headerfiles
Describe alternatives you've considered
Specifing the files I do not want to format at the target-level like so
But it is much less idiomatic, less elegant, and increases my rule's complexity
Additional context
No response
The text was updated successfully, but these errors were encountered: