MCPcopy Create free account
hub / github.com/build-cpp/cmkr / if_condition

Method if_condition

src/cmake_generator.cpp:588–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) {

Callers 1

ConditionScopeMethod · 0.80

Calls 2

RawArgClass · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected