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

Method cmInstallScriptHandler

Source/cmInstallScriptHandler.cxx:36–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34using InstallScriptRunner = cmInstallScriptHandler::InstallScriptRunner;
35
36cmInstallScriptHandler::cmInstallScriptHandler(std::string _binaryDir,
37 std::string _component,
38 std::string _config,
39 std::vector<std::string>& args)
40 : binaryDir(std::move(_binaryDir))
41 , component(std::move(_component))
42{
43 std::string const& file =
44 cmStrCat(this->binaryDir, "/CMakeFiles/InstallScripts.json");
45 this->parallel = false;
46
47 auto addScript = [this, &args](std::string script,
48 std::string config) -> void {
49 this->scripts.push_back({ script, config, args });
50 if (!config.empty()) {
51 this->scripts.back().command.insert(
52 this->scripts.back().command.end() - 1,
53 cmStrCat("-DCMAKE_INSTALL_CONFIG_NAME=", config));
54 }
55 this->scripts.back().command.emplace_back(script);
56 this->directories.push_back(cmSystemTools::GetFilenamePath(script));
57 };
58
59 int compare = 1;
60 if (cmSystemTools::FileExists(file)) {
61 cmSystemTools::FileTimeCompare(
62 cmStrCat(this->binaryDir, "/CMakeFiles/cmake.check_cache"), file,
63 &compare);
64 }
65 if (compare < 1) {
66 Json::CharReaderBuilder rbuilder;
67 auto JsonReader =
68 std::unique_ptr<Json::CharReader>(rbuilder.newCharReader());
69 std::vector<char> content;
70 Json::Value value;
71 cmJSONState state(file, &value);
72 this->parallel = value["Parallel"].asBool();
73 if (this->parallel) {
74 args.insert(args.end() - 1, "-DCMAKE_INSTALL_LOCAL_ONLY=1");
75 }
76 if (_config.empty() && value.isMember("Configs")) {
77 for (auto const& config : value["Configs"]) {
78 this->configs.push_back(config.asCString());
79 }
80 } else {
81 this->configs.push_back(_config);
82 }
83 for (auto const& script : value["InstallScripts"]) {
84 for (auto const& config : configs) {
85 addScript(script.asCString(), config);
86 }
87 if (!this->parallel) {
88 break;
89 }
90 }
91 } else {
92 addScript(cmStrCat(this->binaryDir, "/cmake_install.cmake"), _config);
93 }

Callers

nothing calls this directly

Calls 13

moveFunction · 0.85
push_backMethod · 0.80
emplace_backMethod · 0.80
newCharReaderMethod · 0.80
asBoolMethod · 0.80
isMemberMethod · 0.80
asCStringMethod · 0.80
cmStrCatFunction · 0.70
FileExistsFunction · 0.50
emptyMethod · 0.45
insertMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected