diff options
| author | ruki <[email protected]> | 2021-10-28 23:38:39 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-10-28 23:38:39 +0800 |
| commit | d48ea6ae405def382ece2aa58cad9ab96d6fcd80 (patch) | |
| tree | 9a131dd2f1db79a8f1cd94125563c71507de874a /xmake/plugins | |
| parent | a1e47674d4ce9d61bbb52d084fdf9453eda0d6da (diff) | |
improve custom command
Diffstat (limited to 'xmake/plugins')
| -rw-r--r-- | xmake/plugins/project/cmake/cmakelists.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 0a417c997..a8b64fa95 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -515,7 +515,7 @@ function _add_target_custom_command(cmakelists, target, command, suffix) -- -- @see https://gitlab.kitware.com/cmake/cmake/-/issues/17802 -- - local key = hash.uuid(command):split("-", {plain = true})[1] + local key = target:name() .. "_" .. hash.uuid():split("-", {plain = true})[1] cmakelists:print("add_custom_command(OUTPUT output_%s", key) cmakelists:print(" COMMAND %s", command) cmakelists:print(" VERBATIM") @@ -570,8 +570,9 @@ function _add_target_custom_commands_for_objectrules(cmakelists, target, sourceb script(target, batchcmds_, sourcebatch, {}) if not batchcmds_:empty() then for _, cmd in ipairs(batchcmds_:cmds()) do - if cmd.program then - _add_target_custom_command(cmakelists, target, table.join(cmd.program, cmd.argv), suffix) + local command = _get_command_string(cmd) + if command then + _add_target_custom_command(cmakelists, target, command, suffix) end end end @@ -588,8 +589,9 @@ function _add_target_custom_commands_for_objectrules(cmakelists, target, sourceb script(target, batchcmds_, sourcefile, {}) if not batchcmds_:empty() then for _, cmd in ipairs(batchcmds_:cmds()) do - if cmd.program then - _add_target_custom_command(cmakelists, target, table.join(cmd.program, cmd.argv), suffix) + local command = _get_command_string(cmd) + if command then + _add_target_custom_command(cmakelists, target, command, suffix) end end end |
