| 532 | } |
| 533 | |
| 534 | void inject_cmake(const std::string &cmake) { |
| 535 | if (!cmake.empty()) { |
| 536 | if (cmake.back() == '\"') { |
| 537 | throw std::runtime_error("Detected additional \" at the end of cmake block"); |
| 538 | } |
| 539 | auto cmake_lf = tolf(cmake); |
| 540 | while (!cmake_lf.empty() && cmake_lf.back() == '\n') |
| 541 | cmake_lf.pop_back(); |
| 542 | bool did_indent = false; |
| 543 | for (char ch : cmake_lf) { |
| 544 | if (!did_indent) { |
| 545 | ss << Command::indent(indent); |
| 546 | did_indent = true; |
| 547 | } else if (ch == '\n') { |
| 548 | did_indent = false; |
| 549 | } |
| 550 | ss << ch; |
| 551 | } |
| 552 | ss << '\n'; |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | template <typename T, typename Lambda> |
| 557 | void handle_condition(const parser::Condition<T> &value, const Lambda &fn) { |