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

Method GenerateScriptActions

Source/cmInstallExportGenerator.cxx:204–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202}
203
204void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
205 Indent indent)
206{
207 auto const configImportFilesGlob = this->EFGen->GetConfigImportFileGlob();
208 if (!configImportFilesGlob.empty()) {
209 // Remove old per-configuration export files if the main changes.
210 std::string installedDir = cmStrCat(
211 "$ENV{DESTDIR}", ConvertToAbsoluteDestination(this->Destination), '/');
212 std::string installedFile = cmStrCat(installedDir, this->FileName);
213 os << indent << "if(EXISTS \"" << installedFile << "\")\n";
214 Indent indentN = indent.Next();
215 Indent indentNN = indentN.Next();
216 Indent indentNNN = indentNN.Next();
217 os << indentN << "file(DIFFERENT _cmake_export_file_changed FILES\n"
218 << indentN << " \"" << installedFile << "\"\n"
219 << indentN << " \"" << this->MainImportFile << "\")\n";
220 os << indentN << "if(_cmake_export_file_changed)\n";
221 os << indentNN << "file(GLOB _cmake_old_config_files \"" << installedDir
222 << configImportFilesGlob << "\")\n";
223 os << indentNN << "if(_cmake_old_config_files)\n";
224 os << indentNNN
225 << "string(REPLACE \";\" \", \" _cmake_old_config_files_text "
226 "\"${_cmake_old_config_files}\")\n";
227 os << indentNNN << R"(message(STATUS "Old export file \")" << installedFile
228 << "\\\" will be replaced. "
229 "Removing files [${_cmake_old_config_files_text}].\")\n";
230 os << indentNNN << "unset(_cmake_old_config_files_text)\n";
231 os << indentNNN << "file(REMOVE ${_cmake_old_config_files})\n";
232 os << indentNN << "endif()\n";
233 os << indentNN << "unset(_cmake_old_config_files)\n";
234 os << indentN << "endif()\n";
235 os << indentN << "unset(_cmake_export_file_changed)\n";
236 os << indent << "endif()\n";
237 }
238
239 // Install the main export file.
240 std::vector<std::string> files;
241 files.push_back(this->MainImportFile);
242 this->AddInstallRule(os, this->Destination, cmInstallType_FILES, files,
243 false, this->FilePermissions.c_str(), nullptr, nullptr,
244 nullptr, indent);
245}
246
247std::string cmInstallExportGenerator::GetDestinationFile() const
248{

Callers

nothing calls this directly

Calls 7

push_backMethod · 0.80
AddInstallRuleMethod · 0.80
c_strMethod · 0.80
cmStrCatFunction · 0.70
emptyMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected