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

Method PackageFiles

Source/CPack/cmCPackExternalGenerator.cxx:42–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42int cmCPackExternalGenerator::PackageFiles()
43{
44 Json::StreamWriterBuilder builder;
45 builder["indentation"] = " ";
46
47 std::string filename = "package.json";
48 if (!this->packageFileNames.empty()) {
49 filename = this->packageFileNames[0];
50 }
51
52 {
53 cmGeneratedFileStream fout(filename);
54 std::unique_ptr<Json::StreamWriter> jout(builder.newStreamWriter());
55
56 Json::Value root(Json::objectValue);
57
58 if (!this->Generator->WriteToJSON(root)) {
59 return 0;
60 }
61
62 if (jout->write(root, &fout)) {
63 return 0;
64 }
65 }
66
67 cmValue packageScript = this->GetOption("CPACK_EXTERNAL_PACKAGE_SCRIPT");
68 if (cmNonempty(packageScript)) {
69 if (!cmSystemTools::FileIsFullPath(*packageScript)) {
70 cmCPackLogger(
71 cmCPackLog::LOG_ERROR,
72 "CPACK_EXTERNAL_PACKAGE_SCRIPT does not contain a full file path"
73 << std::endl);
74 return 0;
75 }
76
77 bool res = this->MakefileMap->ReadListFile(*packageScript);
78
79 if (cmSystemTools::GetErrorOccurredFlag() || !res) {
80 return 0;
81 }
82
83 cmValue builtPackages = this->GetOption("CPACK_EXTERNAL_BUILT_PACKAGES");
84 if (builtPackages) {
85 cmExpandList(builtPackages, this->packageFileNames);
86 }
87 }
88
89 return 1;
90}
91
92bool cmCPackExternalGenerator::SupportsComponentInstallation() const
93{

Callers

nothing calls this directly

Calls 8

cmNonemptyFunction · 0.85
cmExpandListFunction · 0.85
newStreamWriterMethod · 0.80
WriteToJSONMethod · 0.80
emptyMethod · 0.45
writeMethod · 0.45
GetOptionMethod · 0.45
ReadListFileMethod · 0.45

Tested by

no test coverage detected