summaryrefslogtreecommitdiff
path: root/Source/cmGetPropertyCommand.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-10-13 00:18:26 +0200
committerStephen Kelly <steveire@gmail.com>2016-10-16 13:56:12 +0200
commitc3fb0d95ad114c9f9680e885c4c2263b43c437dc (patch)
treeb17a83176a79757161a8998b397c81445db17b26 /Source/cmGetPropertyCommand.cxx
parentfa9dbc56a15aec71ac2eda7890efd0116797f373 (diff)
downloadcmake-c3fb0d95ad114c9f9680e885c4c2263b43c437dc.tar.gz
cmTarget: Move sanity checks and computed property access to callers
The GetProperty method is now just accessing contained data, meaning it can be implemented in cmState. Remove the cmMakefile context from the signature as a result and remove the overload with the same signature. Add a GetComputedProperty to cmTarget so that templates can be properly instantiated. Otherwise the Commands would need to be able to reach the specializations which are currently in cmTarget.cxx. As a side-effect, the CMP0026 warning now gives a backtrace to the target when issued from a generator expression.
Diffstat (limited to 'Source/cmGetPropertyCommand.cxx')
-rw-r--r--Source/cmGetPropertyCommand.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index ba03568437..39445dd818 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -6,6 +6,7 @@
#include "cmPropertyDefinition.h"
#include "cmSourceFile.h"
#include "cmState.h"
+#include "cmTargetPropertyComputer.h"
#include "cmTest.h"
#include "cmake.h"
@@ -246,8 +247,18 @@ bool cmGetPropertyCommand::HandleTargetMode()
}
return this->StoreResult(CM_NULLPTR);
}
- return this->StoreResult(
- target->GetProperty(this->PropertyName, this->Makefile));
+ const char* prop_cstr = 0;
+ cmListFileBacktrace bt = this->Makefile->GetBacktrace();
+ cmMessenger* messenger = this->Makefile->GetMessenger();
+ if (cmTargetPropertyComputer::PassesWhitelist(
+ target->GetType(), this->PropertyName, messenger, bt)) {
+ prop_cstr =
+ target->GetComputedProperty(this->PropertyName, messenger, bt);
+ if (!prop_cstr) {
+ prop_cstr = target->GetProperty(this->PropertyName);
+ }
+ }
+ return this->StoreResult(prop_cstr);
}
std::ostringstream e;
e << "could not find TARGET " << this->Name