diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2021-06-08 15:27:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-06-09 14:51:02 (GMT) |
commit | aab9a5fc3e60db247c922f14420b088d9a983ff2 (patch) | |
tree | 93c25c261a661512eed84b74a790ec6abb891141 /Source | |
parent | b0a8fa959cbf8936a7e1aa558cf0c08bfa9e0a39 (diff) | |
download | CMake-aab9a5fc3e60db247c922f14420b088d9a983ff2.zip CMake-aab9a5fc3e60db247c922f14420b088d9a983ff2.tar.gz CMake-aab9a5fc3e60db247c922f14420b088d9a983ff2.tar.bz2 |
cmScanDepFormat: P1689R4: Factor out primary-output field
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmScanDepFormat.cxx | 25 | ||||
-rw-r--r-- | Source/cmScanDepFormat.h | 1 |
2 files changed, 17 insertions, 9 deletions
diff --git a/Source/cmScanDepFormat.cxx b/Source/cmScanDepFormat.cxx index 68ed3b2..d75a750 100644 --- a/Source/cmScanDepFormat.cxx +++ b/Source/cmScanDepFormat.cxx @@ -117,17 +117,20 @@ bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp, return false; } + if (rule.isMember("primary-output")) { + Json::Value const& primary_output = rule["primary-output"]; + PARSE_FILENAME(primary_output, info->PrimaryOutput); + } + if (rule.isMember("outputs")) { Json::Value const& outputs = rule["outputs"]; if (outputs.isArray()) { - if (outputs.empty()) { - cmSystemTools::Error( - cmStrCat("-E cmake_ninja_dyndep failed to parse ", arg_pp, - ": expected at least one 1 output")); - return false; - } + for (auto const& output : outputs) { + std::string extra_output; + PARSE_FILENAME(output, extra_output); - PARSE_FILENAME(outputs[0], info->PrimaryOutput); + info->ExtraOutputs.emplace_back(extra_output); + } } } @@ -202,8 +205,12 @@ bool cmScanDepFormat_P1689_Write(std::string const& path, Json::Value rule(Json::objectValue); - Json::Value& outputs = rule["outputs"] = Json::arrayValue; - outputs.append(info.PrimaryOutput); + rule["primary-output"] = EncodeFilename(info.PrimaryOutput); + + Json::Value& rule_outputs = rule["outputs"] = Json::arrayValue; + for (auto const& output : info.ExtraOutputs) { + rule_outputs.append(EncodeFilename(output)); + } Json::Value& provides = rule["provides"] = Json::arrayValue; for (auto const& provide : info.Provides) { diff --git a/Source/cmScanDepFormat.h b/Source/cmScanDepFormat.h index 51ceec1..cb8921d 100644 --- a/Source/cmScanDepFormat.h +++ b/Source/cmScanDepFormat.h @@ -14,6 +14,7 @@ struct cmSourceReqInfo struct cmScanDepInfo { std::string PrimaryOutput; + std::vector<std::string> ExtraOutputs; // Set of provided and required modules. std::vector<cmSourceReqInfo> Provides; |