diff options
author | Brad King <brad.king@kitware.com> | 2020-06-26 13:34:20 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-06-26 13:34:27 (GMT) |
commit | 6e0143f3399d3f1a0857904d826dbdee7667612a (patch) | |
tree | 006b2462d446b019589c640bb8aaba1e46ee7b2a /Source | |
parent | c4d362e6ee38f2f8d291bfb2dd9fd4707cc40f47 (diff) | |
parent | eae15dce6a3fdb9b02c86891553e5cf408401672 (diff) | |
download | CMake-6e0143f3399d3f1a0857904d826dbdee7667612a.zip CMake-6e0143f3399d3f1a0857904d826dbdee7667612a.tar.gz CMake-6e0143f3399d3f1a0857904d826dbdee7667612a.tar.bz2 |
Merge topic 'config_genex_support_multiple_types'
eae15dce6a Genex: $<CONFIG:> now supports multiple configurations
c4cc21d20b cmVisualStudio10TargetGenerator: Do not segfault on empty config
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4924
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 28 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 5 |
2 files changed, 19 insertions, 14 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 3e0c21c..b712b71 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -881,7 +881,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode { ConfigurationTestNode() {} // NOLINT(modernize-use-equals-default) - int NumExpectedParameters() const override { return OneOrZeroParameters; } + int NumExpectedParameters() const override { return ZeroOrMoreParameters; } std::string Evaluate( const std::vector<std::string>& parameters, @@ -899,13 +899,15 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode return std::string(); } context->HadContextSensitiveCondition = true; - if (context->Config.empty()) { - return parameters.front().empty() ? "1" : "0"; - } - - if (cmsysString_strcasecmp(parameters.front().c_str(), - context->Config.c_str()) == 0) { - return "1"; + for (auto& param : parameters) { + if (context->Config.empty()) { + if (param.empty()) { + return "1"; + } + } else if (cmsysString_strcasecmp(param.c_str(), + context->Config.c_str()) == 0) { + return "1"; + } } if (context->CurrentTarget && context->CurrentTarget->IsImported()) { @@ -922,10 +924,12 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode "MAP_IMPORTED_CONFIG_", cmSystemTools::UpperCase(context->Config)); if (cmProp mapValue = context->CurrentTarget->GetProperty(mapProp)) { cmExpandList(cmSystemTools::UpperCase(*mapValue), mappedConfigs); - return cm::contains(mappedConfigs, - cmSystemTools::UpperCase(parameters.front())) - ? "1" - : "0"; + + for (auto& param : parameters) { + if (cm::contains(mappedConfigs, cmSystemTools::UpperCase(param))) { + return "1"; + } + } } } } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index a3ccd2b..a191f70 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -4131,8 +4131,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) } // Don't reference targets that don't produce any output. - if (dt->GetManagedType(this->Configurations[0]) == - cmGeneratorTarget::ManagedType::Undefined) { + if (this->Configurations.empty() || + dt->GetManagedType(this->Configurations[0]) == + cmGeneratorTarget::ManagedType::Undefined) { e2.Element("ReferenceOutputAssembly", "false"); e2.Element("CopyToOutputDirectory", "Never"); } |