| 138 | } |
| 139 | |
| 140 | void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os, |
| 141 | Indent indent) |
| 142 | { |
| 143 | if (this->ConfigurationTypes->empty()) { |
| 144 | // In a single-configuration generator there is only one action |
| 145 | // and it applies if the runtime-requested configuration is among |
| 146 | // the rule's allowed configurations. The configuration built in |
| 147 | // the tree does not matter for this decision but will be used to |
| 148 | // generate proper target file names into the code. |
| 149 | this->GenerateScriptActionsOnce(os, indent); |
| 150 | } else { |
| 151 | // In a multi-configuration generator we produce a separate rule |
| 152 | // in a block for each configuration that is built. We restrict |
| 153 | // the list of configurations to those to which this rule applies. |
| 154 | bool first = true; |
| 155 | for (std::string const& cfgType : *this->ConfigurationTypes) { |
| 156 | if (this->GeneratesForConfig(cfgType)) { |
| 157 | // Generate a per-configuration block. |
| 158 | std::string config_test = this->CreateConfigTest(cfgType); |
| 159 | os << indent << (first ? "if(" : "elseif(") << config_test << ")\n"; |
| 160 | this->GenerateScriptForConfig(os, cfgType, indent.Next()); |
| 161 | first = false; |
| 162 | } |
| 163 | } |
| 164 | if (!first) { |
| 165 | if (this->NeedsScriptNoConfig()) { |
| 166 | os << indent << "else()\n"; |
| 167 | this->GenerateScriptNoConfig(os, indent.Next()); |
| 168 | } |
| 169 | os << indent << "endif()\n"; |
| 170 | } |
| 171 | } |
| 172 | } |
no test coverage detected