Skip to content

Commit 2e43281

Browse files
committed
added support for headeronly targets in ninja generator (headeronly targets appears as phony target)
1 parent 3cdb8d9 commit 2e43281

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

xmake/plugins/project/ninja/build_ninja.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ function _add_build_for_target(ninjafile, target, outputdir)
352352
target:data_set("plugin.project.kind", "ninja")
353353

354354
-- is phony target?
355-
if target:is_phony() then
355+
if target:is_phony() or target:is_headeronly() then
356356
return _add_build_for_phony(ninjafile, target)
357357
end
358358

@@ -378,7 +378,10 @@ function _add_build_for_target(ninjafile, target, outputdir)
378378
ninjafile:print(" || $")
379379
ninjafile:write(" ")
380380
for _, dep in ipairs(deps) do
381-
ninjafile:write(" " .. _get_relative_unix_path(project.target(dep, {namespace = target:namespace()}):targetfile(), outputdir))
381+
local dep_target = project.target(dep, {namespace = target:namespace()});
382+
if not dep_target:is_headeronly() then
383+
ninjafile:write(" " .. _get_relative_unix_path(dep_target:targetfile(), outputdir))
384+
end
382385
end
383386
end
384387
ninjafile:print("")

0 commit comments

Comments
 (0)