diff options
author | Brad King <brad.king@kitware.com> | 2020-10-20 20:37:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-12-16 19:04:30 (GMT) |
commit | 92d7b456e581453cf7a223c60c8734a88d887534 (patch) | |
tree | 99970c99741a78116befb01a1b4c4f90f8da5e95 /Source/cmQtAutoMocUic.cxx | |
parent | 3ffebbaefb876f40c2d2751b58800cacf4951407 (diff) | |
download | CMake-92d7b456e581453cf7a223c60c8734a88d887534.zip CMake-92d7b456e581453cf7a223c60c8734a88d887534.tar.gz CMake-92d7b456e581453cf7a223c60c8734a88d887534.tar.bz2 |
Autogen: Add support for per-config sources
Fixes: #20682
Diffstat (limited to 'Source/cmQtAutoMocUic.cxx')
-rw-r--r-- | Source/cmQtAutoMocUic.cxx | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index b27bb88..c9d4268 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -2452,17 +2452,20 @@ bool cmQtAutoMocUicT::InitFromInfo(InfoT const& info) Json::Value const& entry = val[ii]; if (testEntry(entry.isArray(), "JSON value is not an array.") || - testEntry(entry.size() == 3, "JSON array size invalid.")) { + testEntry(entry.size() == 4, "JSON array size invalid.")) { return false; } Json::Value const& entryName = entry[0u]; Json::Value const& entryFlags = entry[1u]; - Json::Value const& entryBuild = entry[2u]; + Json::Value const& entryConfigs = entry[2u]; + Json::Value const& entryBuild = entry[3u]; if (testEntry(entryName.isString(), "JSON value for name is not a string.") || testEntry(entryFlags.isString(), "JSON value for flags is not a string.") || + testEntry(entryConfigs.isNull() || entryConfigs.isArray(), + "JSON value for configs is not null or array.") || testEntry(entryBuild.isString(), "JSON value for build path is not a string.")) { return false; @@ -2475,6 +2478,22 @@ bool cmQtAutoMocUicT::InitFromInfo(InfoT const& info) return false; } + if (entryConfigs.isArray()) { + bool configFound = false; + Json::ArrayIndex const configArraySize = entryConfigs.size(); + for (Json::ArrayIndex ci = 0; ci != configArraySize; ++ci) { + Json::Value const& config = entryConfigs[ci]; + if (testEntry(config.isString(), + "JSON value in config array is not a string.")) { + return false; + } + configFound = configFound || config.asString() == this->InfoConfig(); + } + if (!configFound) { + continue; + } + } + cmFileTime fileTime; if (!fileTime.Load(name)) { return info.LogError(cmStrCat( @@ -2515,16 +2534,19 @@ bool cmQtAutoMocUicT::InitFromInfo(InfoT const& info) Json::Value const& entry = val[ii]; if (testEntry(entry.isArray(), "JSON value is not an array.") || - testEntry(entry.size() == 2, "JSON array size invalid.")) { + testEntry(entry.size() == 3, "JSON array size invalid.")) { return false; } Json::Value const& entryName = entry[0u]; Json::Value const& entryFlags = entry[1u]; + Json::Value const& entryConfigs = entry[2u]; if (testEntry(entryName.isString(), "JSON value for name is not a string.") || testEntry(entryFlags.isString(), - "JSON value for flags is not a string.")) { + "JSON value for flags is not a string.") || + testEntry(entryConfigs.isNull() || entryConfigs.isArray(), + "JSON value for configs is not null or array.")) { return false; } @@ -2534,6 +2556,22 @@ bool cmQtAutoMocUicT::InitFromInfo(InfoT const& info) return false; } + if (entryConfigs.isArray()) { + bool configFound = false; + Json::ArrayIndex const configArraySize = entryConfigs.size(); + for (Json::ArrayIndex ci = 0; ci != configArraySize; ++ci) { + Json::Value const& config = entryConfigs[ci]; + if (testEntry(config.isString(), + "JSON value in config array is not a string.")) { + return false; + } + configFound = configFound || config.asString() == this->InfoConfig(); + } + if (!configFound) { + continue; + } + } + cmFileTime fileTime; if (!fileTime.Load(name)) { return info.LogError(cmStrCat( |