diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2019-11-22 13:43:32 -0500 |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2019-11-25 11:08:27 -0500 |
commit | f9f294f5faf980aa39721e4deb465b2e9dbbbd9a (patch) | |
tree | 3f9210c5f80ab9f1199daaaa44ebeb84930f7335 /Source/CTest | |
parent | 99f0881d8c6d0c435e595c5f9510da776827ee3e (diff) | |
download | cmake-f9f294f5faf980aa39721e4deb465b2e9dbbbd9a.tar.gz |
CTest: Add version field to resource spec file
Fixes: #20007
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestResourceSpec.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestResourceSpec.cxx b/Source/CTest/cmCTestResourceSpec.cxx index b4a2b30c9c..237a745c9f 100644 --- a/Source/CTest/cmCTestResourceSpec.cxx +++ b/Source/CTest/cmCTestResourceSpec.cxx @@ -33,6 +33,32 @@ bool cmCTestResourceSpec::ReadFromJSONFile(const std::string& filename) return false; } + int majorVersion = 1; + int minorVersion = 0; + if (root.isMember("version")) { + auto const& version = root["version"]; + if (version.isObject()) { + if (!version.isMember("major") || !version.isMember("minor")) { + return false; + } + auto const& major = version["major"]; + auto const& minor = version["minor"]; + if (!major.isInt() || !minor.isInt()) { + return false; + } + majorVersion = major.asInt(); + minorVersion = minor.asInt(); + } else { + return false; + } + } else { + return false; + } + + if (majorVersion != 1 || minorVersion != 0) { + return false; + } + auto const& local = root["local"]; if (!local.isArray()) { return false; |