diff options
author | Brad King <brad.king@kitware.com> | 2018-09-07 14:56:17 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-09-12 16:46:25 (GMT) |
commit | 2f708f5d65557ecbfe4ebe7c14b02dbba6bf0ffe (patch) | |
tree | 1fa50eade95a0394af49aaca5489839dcfad5d29 /Source/cmGeneratorTarget.cxx | |
parent | 94a75801c834891f47358e9f5763c56245dff3fe (diff) | |
download | CMake-2f708f5d65557ecbfe4ebe7c14b02dbba6bf0ffe.zip CMake-2f708f5d65557ecbfe4ebe7c14b02dbba6bf0ffe.tar.gz CMake-2f708f5d65557ecbfe4ebe7c14b02dbba6bf0ffe.tar.bz2 |
Make internal TARGET_PROPERTY generator expressions more robust
While collecting usage requirements from the `INTERFACE_*` properties of
directly linked targets, we internally generate `TARGET_PROPERTY:` and
`TARGET_OBJECTS:` generator expressions to refer to those properties on
those targets. At the point we generate these expressions we already
have a pointer to an exact `cmGeneratorTarget` instance.
Switch from using the target name in these generator expressions to
using an internal unique name generated for each `cmGeneratorTarget`
instance to be referenced. This avoids depending on the user-facing
target name to find the same target we already have.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e8e7b90..40ee01e 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -819,8 +819,11 @@ static void AddInterfaceEntries( thisTarget->GetLinkImplementationLibraries(config)) { for (cmLinkImplItem const& lib : impl->Libraries) { if (lib.Target) { + std::string uniqueName = + thisTarget->GetGlobalGenerator()->IndexGeneratorTargetUniquely( + lib.Target); std::string genex = - "$<TARGET_PROPERTY:" + lib.AsStr() + "," + prop + ">"; + "$<TARGET_PROPERTY:" + std::move(uniqueName) + "," + prop + ">"; cmGeneratorExpression ge(lib.Backtrace); std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex); cge->SetEvaluateForBuildsystem(true); @@ -840,7 +843,10 @@ static void AddObjectEntries( for (cmLinkImplItem const& lib : impl->Libraries) { if (lib.Target && lib.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) { - std::string genex = "$<TARGET_OBJECTS:" + lib.AsStr() + ">"; + std::string uniqueName = + thisTarget->GetGlobalGenerator()->IndexGeneratorTargetUniquely( + lib.Target); + std::string genex = "$<TARGET_OBJECTS:" + std::move(uniqueName) + ">"; cmGeneratorExpression ge(lib.Backtrace); std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex); cge->SetEvaluateForBuildsystem(true); |