| 1186 | } |
| 1187 | |
| 1188 | void 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 | |
| 1232 | void cmLocalUnixMakefileGenerator3::AppendEcho( |
| 1233 | std::vector<std::string>& commands, std::string const& text, EchoColor color, |
no test coverage detected