diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionDAGChecker.cxx | 9 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionDAGChecker.h | 1 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 9 |
4 files changed, 27 insertions, 6 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 5fe6756..8f74ceb 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -7,6 +7,8 @@ #include <utility> #include "cmComputeLinkInformation.h" +#include "cmGeneratorExpression.h" +#include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorTarget.h" #include "cmGlobalCommonGenerator.h" #include "cmGlobalGenerator.h" @@ -283,11 +285,17 @@ std::string cmCommonTargetGenerator::GetLinkerLauncher( const std::string& config) { std::string lang = this->GeneratorTarget->GetLinkerLanguage(config); - cmValue launcherProp = - this->GeneratorTarget->GetProperty(lang + "_LINKER_LAUNCHER"); + std::string propName = lang + "_LINKER_LAUNCHER"; + cmValue launcherProp = this->GeneratorTarget->GetProperty(propName); if (cmNonempty(launcherProp)) { + cmGeneratorExpressionDAGChecker dagChecker(this->GeneratorTarget, propName, + nullptr, nullptr); + std::string evaluatedLinklauncher = cmGeneratorExpression::Evaluate( + *launcherProp, this->LocalCommonGenerator, config, this->GeneratorTarget, + &dagChecker, this->GeneratorTarget, lang); // Convert ;-delimited list to single string - std::vector<std::string> args = cmExpandedList(*launcherProp, true); + std::vector<std::string> args = + cmExpandedList(evaluatedLinklauncher, true); if (!args.empty()) { args[0] = this->LocalCommonGenerator->ConvertToOutputFormat( args[0], cmOutputConverter::SHELL); diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 6be5153..82a6c57 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -177,6 +177,15 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkOptionsExpression() const return property == "LINK_OPTIONS"_s; } +bool cmGeneratorExpressionDAGChecker::EvaluatingLinkerLauncher() const +{ + cm::string_view property(this->Top()->Property); + + return property.length() > cmStrLen("_LINKER_LAUNCHER") && + property.substr(property.length() - cmStrLen("_LINKER_LAUNCHER")) == + "_LINKER_LAUNCHER"_s; +} + bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries( cmGeneratorTarget const* tgt, ForGenex genex) const { diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index 55d131f..df1e005 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -70,6 +70,7 @@ struct cmGeneratorExpressionDAGChecker bool EvaluatingCompileExpression() const; bool EvaluatingLinkExpression() const; bool EvaluatingLinkOptionsExpression() const; + bool EvaluatingLinkerLauncher() const; enum class ForGenex { diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 6595323..4c6dda9 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1548,7 +1548,8 @@ static const struct LinkLanguageNode : public cmGeneratorExpressionNode { if (!context->HeadTarget || !dagChecker || !(dagChecker->EvaluatingLinkExpression() || - dagChecker->EvaluatingLinkLibraries())) { + dagChecker->EvaluatingLinkLibraries() || + dagChecker->EvaluatingLinkerLauncher())) { reportError(context, content->GetOriginalExpression(), "$<LINK_LANGUAGE:...> may only be used with binary targets " "to specify link libraries, link directories, link options " @@ -1641,7 +1642,8 @@ static const struct LinkLanguageAndIdNode : public cmGeneratorExpressionNode { if (!context->HeadTarget || !dagChecker || !(dagChecker->EvaluatingLinkExpression() || - dagChecker->EvaluatingLinkLibraries())) { + dagChecker->EvaluatingLinkLibraries() || + dagChecker->EvaluatingLinkerLauncher())) { reportError( context, content->GetOriginalExpression(), "$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets " @@ -2098,7 +2100,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode if (dagCheckerParent) { if (dagCheckerParent->EvaluatingGenexExpression() || - dagCheckerParent->EvaluatingPICExpression()) { + dagCheckerParent->EvaluatingPICExpression() || + dagCheckerParent->EvaluatingLinkerLauncher()) { // No check required. } else if (dagCheckerParent->EvaluatingLinkLibraries()) { evaluatingLinkLibraries = true; |