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

Method AppendDirectoryCleanCommand

Source/cmLocalUnixMakefileGenerator3.cxx:1188–1230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1186}
1187
1188void cmLocalUnixMakefileGenerator3::AppendDirectoryCleanCommand(
1189 std::vector<std::string>& commands)
1190{
1191 cmList cleanFiles;
1192 // Look for additional files registered for cleaning in this directory.
1193 if (cmValue prop_value =
1194 this->Makefile->GetProperty("ADDITIONAL_CLEAN_FILES")) {
1195 cleanFiles.assign(cmGeneratorExpression::Evaluate(
1196 *prop_value, this,
1197 this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")));
1198 }
1199 if (cleanFiles.empty()) {
1200 return;
1201 }
1202
1203 auto const& rootLG = this->GetGlobalGenerator()->GetLocalGenerators().at(0);
1204 std::string const& currentBinaryDir = this->GetCurrentBinaryDirectory();
1205 std::string cleanfile =
1206 cmStrCat(currentBinaryDir, "/CMakeFiles/cmake_directory_clean.cmake");
1207 // Write clean script
1208 {
1209 cmsys::ofstream fout(cleanfile.c_str());
1210 if (!fout) {
1211 cmSystemTools::Error("Could not create " + cleanfile);
1212 return;
1213 }
1214 fout << "file(REMOVE_RECURSE\n";
1215 for (std::string const& cfl : cleanFiles) {
1216 std::string fc = rootLG->MaybeRelativeToCurBinDir(
1217 cmSystemTools::CollapseFullPath(cfl, currentBinaryDir));
1218 fout << " " << cmOutputConverter::EscapeForCMake(fc) << '\n';
1219 }
1220 fout << ")\n";
1221 }
1222 // Create command
1223 {
1224 std::string remove = cmStrCat(
1225 "$(CMAKE_COMMAND) -P ",
1226 this->ConvertToOutputFormat(rootLG->MaybeRelativeToCurBinDir(cleanfile),
1227 cmOutputConverter::SHELL));
1228 commands.push_back(std::move(remove));
1229 }
1230}
1231
1232void cmLocalUnixMakefileGenerator3::AppendEcho(
1233 std::vector<std::string>& commands, std::string const& text, EchoColor color,

Callers 1

WriteDirectoryRules2Method · 0.80

Calls 12

moveFunction · 0.85
assignMethod · 0.80
c_strMethod · 0.80
push_backMethod · 0.80
cmStrCatFunction · 0.70
ErrorClass · 0.70
GetPropertyMethod · 0.45
emptyMethod · 0.45
atMethod · 0.45
GetGlobalGeneratorMethod · 0.45
ConvertToOutputFormatMethod · 0.45

Tested by

no test coverage detected