authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-09 21:20:13-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-09 21:21:27-07:00
logb4c0396d3cdd04fcced585bb304685dcdc33d874
tree0ee81448e1c90ea67e49080bca984d9139d47aa6
parent97692cb4fefcfe54564fdea0e70b656aec5e6f77

CLI: infer --name based on first C source file or object

Previously, --name would only be inferred if there was exactly 1 C source file or exactly 1 object. Now it will be inferred if there is at least one of either.

1 files changed, 2 insertions(+), 2 deletions(-)

src/main.zig+2-2
...@@ -1311,10 +1311,10 @@ fn buildOutputType(...@@ -1311,10 +1311,10 @@ fn buildOutputType(
1311 } else if (root_src_file) |file| {1311 } else if (root_src_file) |file| {
1312 const basename = fs.path.basename(file);1312 const basename = fs.path.basename(file);
1313 break :blk mem.split(basename, ".").next().?;1313 break :blk mem.split(basename, ".").next().?;
1314 } else if (c_source_files.items.len == 1) {1314 } else if (c_source_files.items.len >= 1) {
1315 const basename = fs.path.basename(c_source_files.items[0].src_path);1315 const basename = fs.path.basename(c_source_files.items[0].src_path);
1316 break :blk mem.split(basename, ".").next().?;1316 break :blk mem.split(basename, ".").next().?;
1317 } else if (link_objects.items.len == 1) {1317 } else if (link_objects.items.len >= 1) {
1318 const basename = fs.path.basename(link_objects.items[0]);1318 const basename = fs.path.basename(link_objects.items[0]);
1319 break :blk mem.split(basename, ".").next().?;1319 break :blk mem.split(basename, ".").next().?;
1320 } else if (emit_bin == .yes) {1320 } else if (emit_bin == .yes) {