MCPcopy Create free account
hub / github.com/Kitware/CMake / WriteTargetBuildRules

Method WriteTargetBuildRules

Source/cmMakefileTargetGenerator.cxx:204–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202}
203
204void cmMakefileTargetGenerator::WriteTargetBuildRules()
205{
206 cm::GenEx::Context context(this->LocalGenerator, this->GetConfigName());
207 this->GeneratorTarget->CheckCxxModuleStatus(this->GetConfigName());
208
209 // -- Write the custom commands for this target
210
211 // Evaluates generator expressions and expands prop_value
212 auto evaluatedFiles = [this](std::string const& prop_value) -> cmList {
213 cmList files{ cmGeneratorExpression::Evaluate(
214 prop_value, this->LocalGenerator, this->GetConfigName(),
215 this->GeneratorTarget) };
216 return files;
217 };
218
219 // Look for additional files registered for cleaning in this directory.
220 if (cmValue prop_value =
221 this->Makefile->GetProperty("ADDITIONAL_MAKE_CLEAN_FILES")) {
222 auto const files = evaluatedFiles(*prop_value);
223 this->CleanFiles.insert(files.begin(), files.end());
224 }
225
226 // Look for additional files registered for cleaning in this target.
227 if (cmValue prop_value =
228 this->GeneratorTarget->GetProperty("ADDITIONAL_CLEAN_FILES")) {
229 auto const files = evaluatedFiles(*prop_value);
230 // For relative path support
231 std::string const& binaryDir =
232 this->LocalGenerator->GetCurrentBinaryDirectory();
233 for (std::string const& cfl : files) {
234 this->CleanFiles.insert(cmSystemTools::CollapseFullPath(cfl, binaryDir));
235 }
236 }
237
238 // Look for ISPC extra object files generated by this target
239 auto const ispcAdditionalObjs =
240 this->GeneratorTarget->GetGeneratedISPCObjects(this->GetConfigName());
241 for (std::string const& ispcObj : ispcAdditionalObjs) {
242 this->CleanFiles.insert(
243 this->LocalGenerator->MaybeRelativeToCurBinDir(ispcObj));
244 }
245
246 // add custom commands to the clean rules?
247 bool const clean = this->Makefile->GetProperty("CLEAN_NO_CUSTOM").IsOff();
248
249 // First generate the object rule files. Save a list of all object
250 // files for this target.
251 std::vector<cmSourceFile const*> customCommands;
252 this->GeneratorTarget->GetCustomCommands(customCommands,
253 this->GetConfigName());
254 std::vector<std::string> codegen_depends;
255 codegen_depends.reserve(customCommands.size());
256 for (cmSourceFile const* sf : customCommands) {
257 if (this->CMP0113New &&
258 !this->LocalGenerator->GetCommandsVisited(this->GeneratorTarget)
259 .insert(sf)
260 .second) {
261 continue;

Callers 3

WriteRuleFilesMethod · 0.80
WriteRuleFilesMethod · 0.80
WriteRuleFilesMethod · 0.80

Calls 15

WriteObjectRuleFilesMethod · 0.95
moveFunction · 0.85
appendFunction · 0.85
cmHasSuffixFunction · 0.85
CheckCxxModuleStatusMethod · 0.80
GetCustomCommandsMethod · 0.80
reserveMethod · 0.80
GetCustomCommandMethod · 0.80
GetCodegenMethod · 0.80

Tested by

no test coverage detected