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

Method GenerateImportFile

Source/cmExportFileGenerator.cxx:54–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54bool 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
81std::string cmExportFileGenerator::PropertyConfigSuffix(
82 std::string const& config)

Callers 3

GenerateMethod · 0.45
GenerateScriptMethod · 0.45
TryCompileCodeMethod · 0.45

Calls 5

moveFunction · 0.85
c_strMethod · 0.80
SetCopyIfDifferentMethod · 0.80
strMethod · 0.80
ErrorClass · 0.70

Tested by

no test coverage detected