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

Method WriteRuleFiles

Source/cmMakefileUtilityTargetGenerator.cxx:33–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 default;
32
33void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
34{
35 this->CreateRuleFile();
36
37 *this->BuildFileStream << "# Utility rule file for "
38 << this->GeneratorTarget->GetName() << ".\n\n";
39
40 char const* root = (this->Makefile->IsOn("CMAKE_MAKE_INCLUDE_FROM_ROOT")
41 ? "$(CMAKE_BINARY_DIR)/"
42 : "");
43
44 // Include the dependencies for the target.
45 std::string dependFile =
46 cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.make");
47 *this->BuildFileStream
48 << "# Include any custom commands dependencies for this target.\n"
49 << this->GlobalGenerator->IncludeDirective << " " << root
50 << cmSystemTools::ConvertToOutputPath(
51 this->LocalGenerator->MaybeRelativeToTopBinDir(dependFile))
52 << "\n\n";
53 if (!cmSystemTools::FileExists(dependFile)) {
54 // Write an empty dependency file.
55 cmGeneratedFileStream depFileStream(
56 dependFile, false, this->GlobalGenerator->GetMakefileEncoding());
57 depFileStream << "# Empty custom commands generated dependencies file for "
58 << this->GeneratorTarget->GetName()
59 << ".\n"
60 "# This may be replaced when dependencies are built.\n";
61 }
62
63 std::string dependTimestamp =
64 cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.ts");
65 if (!cmSystemTools::FileExists(dependTimestamp)) {
66 // Write a dependency timestamp file.
67 cmGeneratedFileStream depFileStream(
68 dependTimestamp, false, this->GlobalGenerator->GetMakefileEncoding());
69 depFileStream << "# CMAKE generated file: DO NOT EDIT!\n"
70 "# Timestamp file for custom commands dependencies "
71 "management for "
72 << this->GeneratorTarget->GetName() << ".\n";
73 }
74
75 if (!this->NoRuleMessages) {
76 // Include the progress variables for the target.
77 *this->BuildFileStream
78 << "# Include the progress variables for this target.\n"
79 << this->GlobalGenerator->IncludeDirective << " " << root
80 << cmSystemTools::ConvertToOutputPath(
81 this->LocalGenerator->MaybeRelativeToTopBinDir(
82 this->ProgressFileNameFull))
83 << "\n\n";
84 }
85
86 // write the custom commands for this target
87 this->WriteTargetBuildRules();
88
89 // Collect the commands and dependencies.
90 std::vector<std::string> commands;

Callers 1

GenerateMethod · 0.45

Calls 15

moveFunction · 0.85
CreateRuleFileMethod · 0.80
WriteTargetBuildRulesMethod · 0.80
AppendCustomDependsMethod · 0.80
AppendCustomCommandsMethod · 0.80
DriveCustomCommandsMethod · 0.80
AppendRuleDependMethod · 0.80
c_strMethod · 0.80
push_backMethod · 0.80
WriteTargetDriverRuleMethod · 0.80

Tested by

no test coverage detected