| ... | ... | @@ -303,10 +303,7 @@ fn render_cmake( |
| 303 | 303 | var line_index: u32 = 0; |
| 304 | 304 | var line_it = std.mem.splitScalar(u8, contents, '\n'); |
| 305 | 305 | while (line_it.next()) |raw_line| : (line_index += 1) { |
| 306 | | // if we reached the end of the buffer there is nothing worth doing anymore |
| 307 | | if (line_it.index == line_it.buffer.len) { |
| 308 | | continue; |
| 309 | | } |
| 306 | const last_line = line_it.index == line_it.buffer.len; |
| 310 | 307 | |
| 311 | 308 | const first_pass = replace_variables(allocator, raw_line, values, "@", "@") catch @panic("Failed to substitute"); |
| 312 | 309 | const line = replace_variables(allocator, first_pass, values, "${", "}") catch @panic("Failed to substitute"); |
| ... | ... | @@ -316,7 +313,9 @@ fn render_cmake( |
| 316 | 313 | |
| 317 | 314 | if (!std.mem.startsWith(u8, line, "#")) { |
| 318 | 315 | try output.appendSlice(line); |
| 319 | | try output.appendSlice("\n"); |
| 316 | if (!last_line) { |
| 317 | try output.appendSlice("\n"); |
| 318 | } |
| 320 | 319 | continue; |
| 321 | 320 | } |
| 322 | 321 | var it = std.mem.tokenizeAny(u8, line[1..], " \t\r"); |
| ... | ... | @@ -325,7 +324,9 @@ fn render_cmake( |
| 325 | 324 | !std.mem.eql(u8, cmakedefine, "cmakedefine01")) |
| 326 | 325 | { |
| 327 | 326 | try output.appendSlice(line); |
| 328 | | try output.appendSlice("\n"); |
| 327 | if (!last_line) { |
| 328 | try output.appendSlice("\n"); |
| 329 | } |
| 329 | 330 | continue; |
| 330 | 331 | } |
| 331 | 332 | |