| 586 | } |
| 587 | |
| 588 | bool if_condition(const std::string &condition) { |
| 589 | if (condition.empty()) { |
| 590 | return false; |
| 591 | } |
| 592 | auto found = project.conditions.find(condition); |
| 593 | if (found == project.conditions.end()) { |
| 594 | if (cmkr::parser::Project::is_condition_name(condition)) { |
| 595 | // NOTE: this should have been caught by the parser already |
| 596 | throw std::runtime_error("Condition '" + condition + "' is not defined"); |
| 597 | } |
| 598 | cmd("if", "NOTE: unnamed condition")(RawArg(cmake_condition(condition))); |
| 599 | } else { |
| 600 | cmd("if", condition)(RawArg(cmake_condition(found->second))); |
| 601 | } |
| 602 | return true; |
| 603 | } |
| 604 | |
| 605 | private: |
| 606 | std::string cmake_condition(const std::string &condition) { |
no test coverage detected