| 52 | } |
| 53 | |
| 54 | bool cmExportFileGenerator::GenerateImportFile() |
| 55 | { |
| 56 | // Open the output file to generate it. |
| 57 | std::unique_ptr<cmsys::ofstream> foutPtr; |
| 58 | if (this->AppendMode) { |
| 59 | // Open for append. |
| 60 | auto openmodeApp = std::ios::app; |
| 61 | foutPtr = cm::make_unique<cmsys::ofstream>(this->MainImportFile.c_str(), |
| 62 | openmodeApp); |
| 63 | } else { |
| 64 | // Generate atomically and with copy-if-different. |
| 65 | std::unique_ptr<cmGeneratedFileStream> ap( |
| 66 | new cmGeneratedFileStream(this->MainImportFile, true)); |
| 67 | ap->SetCopyIfDifferent(true); |
| 68 | foutPtr = std::move(ap); |
| 69 | } |
| 70 | if (!foutPtr || !*foutPtr) { |
| 71 | std::string se = cmSystemTools::GetLastSystemError(); |
| 72 | std::ostringstream e; |
| 73 | e << "cannot write to file \"" << this->MainImportFile << "\": " << se; |
| 74 | cmSystemTools::Error(e.str()); |
| 75 | return false; |
| 76 | } |
| 77 | |
| 78 | return this->GenerateImportFile(*foutPtr); |
| 79 | } |
| 80 | |
| 81 | std::string cmExportFileGenerator::PropertyConfigSuffix( |
| 82 | std::string const& config) |
no test coverage detected