summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmFileAPICodemodel.cxx4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-check.py15
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json1
3 files changed, 12 insertions, 8 deletions
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index c0c9b75..e67d91f 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -2102,7 +2102,9 @@ Json::Value Target::DumpLauncher(const char* name, const char* type)
for (std::string const& arg : cmMakeRange(commandWithArgs).advance(1)) {
args.append(arg);
}
- launcher["arguments"] = std::move(args);
+ if (!args.empty()) {
+ launcher["arguments"] = std::move(args);
+ }
}
return launcher;
}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
index cb90eba..f46448b 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
@@ -410,15 +410,18 @@ def check_target(c):
expected_keys.append("launchers")
def check_launcher(actual, expected):
assert is_dict(actual)
- launcher_keys = ["arguments", "command", "type"]
+ launcher_keys = ["command", "type"]
+ if "arguments" in expected:
+ launcher_keys.append("arguments")
assert sorted(actual.keys()) == sorted(launcher_keys)
assert matches(actual["command"], expected["command"])
assert matches(actual["type"], expected["type"])
- if expected["arguments"] is not None:
- check_list_match(lambda a, e: matches(a, e),
- actual["arguments"], expected["arguments"],
- missing_exception=lambda e: "argument: %s" % e,
- extra_exception=lambda a: "argument: %s" % actual["arguments"])
+ if "arguments" in expected:
+ if expected["arguments"] is not None:
+ check_list_match(lambda a, e: matches(a, e),
+ actual["arguments"], expected["arguments"],
+ missing_exception=lambda e: "argument: %s" % e,
+ extra_exception=lambda a: "argument: %s" % actual["arguments"])
check_list_match(lambda a, e: matches(a["type"], e["type"]),
obj["launchers"], expected["launchers"],
check=check_launcher,
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json
index 9bd2d5d..bbd973b 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json
@@ -80,7 +80,6 @@
"install": null,
"launchers" : [
{
- "arguments" : null,
"command": "^no-such-emulator(\\.exe)?$",
"type" : "emulator"
}