summaryrefslogtreecommitdiffstats
path: root/Source/cmGetTargetPropertyCommand.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-10-12 22:18:26 (GMT)
committerStephen Kelly <steveire@gmail.com>2016-10-16 11:56:12 (GMT)
commitc3fb0d95ad114c9f9680e885c4c2263b43c437dc (patch)
treeb17a83176a79757161a8998b397c81445db17b26 /Source/cmGetTargetPropertyCommand.cxx
parentfa9dbc56a15aec71ac2eda7890efd0116797f373 (diff)
downloadCMake-c3fb0d95ad114c9f9680e885c4c2263b43c437dc.zip
CMake-c3fb0d95ad114c9f9680e885c4c2263b43c437dc.tar.gz
CMake-c3fb0d95ad114c9f9680e885c4c2263b43c437dc.tar.bz2
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/cmGetTargetPropertyCommand.cxx')
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index fe09442..6a816d8 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGetTargetPropertyCommand.h"
+#include "cmTargetPropertyComputer.h"
+
// cmSetTargetPropertyCommand
bool cmGetTargetPropertyCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&)
@@ -22,7 +24,16 @@ bool cmGetTargetPropertyCommand::InitialPass(
prop_exists = true;
}
} else if (!args[2].empty()) {
- const char* prop_cstr = tgt->GetProperty(args[2], this->Makefile);
+ const char* prop_cstr = 0;
+ cmListFileBacktrace bt = this->Makefile->GetBacktrace();
+ cmMessenger* messenger = this->Makefile->GetMessenger();
+ if (cmTargetPropertyComputer::PassesWhitelist(tgt->GetType(), args[2],
+ messenger, bt)) {
+ prop_cstr = tgt->GetComputedProperty(args[2], messenger, bt);
+ if (!prop_cstr) {
+ prop_cstr = tgt->GetProperty(args[2]);
+ }
+ }
if (prop_cstr) {
prop = prop_cstr;
prop_exists = true;