Commit 01e34c1cd9

Andrew Kelley <andrew@ziglang.org>
2023-01-08 02:12:20
std.build.ConfigHeaderStep: stub out cmake style
1 parent ea79201
Changed files (1)
lib
lib/std/build/ConfigHeaderStep.zig
@@ -151,6 +151,20 @@ fn make(step: *Step) !void {
 
     try output.appendSlice("/* This file was generated by ConfigHeaderStep using the Zig Build System. */\n");
 
+    switch (self.style) {
+        .autoconf => try render_autoconf(contents, &output, &values_copy, src_path),
+        .cmake => try render_cmake(contents, &output, &values_copy, src_path),
+    }
+
+    try dir.writeFile(self.output_basename, output.items);
+}
+
+fn render_autoconf(
+    contents: []const u8,
+    output: *std.ArrayList(u8),
+    values_copy: *std.StringHashMap(Value),
+    src_path: []const u8,
+) !void {
     var any_errors = false;
     var line_index: u32 = 0;
     var line_it = std.mem.split(u8, contents, "\n");
@@ -216,6 +230,17 @@ fn make(step: *Step) !void {
     if (any_errors) {
         return error.HeaderConfigFailed;
     }
+}
 
-    try dir.writeFile(self.output_basename, output.items);
+fn render_cmake(
+    contents: []const u8,
+    output: *std.ArrayList(u8),
+    values_copy: *std.StringHashMap(Value),
+    src_path: []const u8,
+) !void {
+    _ = contents;
+    _ = output;
+    _ = values_copy;
+    _ = src_path;
+    @panic("TODO: render_cmake is not implemented yet");
 }