summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-10-17 14:15:21 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-10-17 14:15:21 (GMT)
commit188c762f8a5f690708109a3cb8d44693e599adb1 (patch)
treeaccfc739aed26006b7f2ea813aac324caed11aa4 /Source/cmGeneratorTarget.cxx
parent9a2048f1ea6687530e209992c3f5eafcbc02b2a9 (diff)
parentcef59bb8bac6b6d38025cc492235953c5ff7654b (diff)
downloadCMake-188c762f8a5f690708109a3cb8d44693e599adb1.zip
CMake-188c762f8a5f690708109a3cb8d44693e599adb1.tar.gz
CMake-188c762f8a5f690708109a3cb8d44693e599adb1.tar.bz2
Merge topic 'extract-computed-target-properties'
cef59bb8 cmTarget: Implement GetProperty in terms of cmState::Snapshot 0d57b07a cmTarget: Group code for checking written properties together c3fb0d95 cmTarget: Move sanity checks and computed property access to callers fa9dbc56 cmGeneratorTarget: Implement cmTargetPropertyComputer interface 848ae2a6 cmTargetPropertyComputer: Template some methods on the Target a0a720e6 cm{,Generator}Target: Add global generator accessors 637e3f3e cmTargetPropertyComputer: Unify whitelist handling from cmTarget 05251e6d cmTargetPropertyComputer: Move whitelist check from cmTarget fbf1721c cmTargetPropertyComputer: Extract into new files 390a7d86 cmTargetPropertyComputer: Implement GetProperty without cmMakefile e32a6bdd cmListFileBacktrace: Add a method to retrieve the Bottom of a snapshot 7863fba1 cmTarget: Extract GetLocation method 8096682e cmTarget: Extract GetSources method 7d57c1a2 cmTarget: Extract location computation methods a55cac4b cmTarget: Split property computation into separate class 705fcf52 cmTarget: Move IMPORTED check to callers ...
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx57
1 files changed, 56 insertions, 1 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f11149a..b16cfc6 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -18,6 +18,7 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
+#include "cmTargetPropertyComputer.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
@@ -42,6 +43,28 @@
#define UNORDERED_SET std::set
#endif
+template <>
+const char* cmTargetPropertyComputer::GetSources<cmGeneratorTarget>(
+ cmGeneratorTarget const* tgt, cmMessenger* /* messenger */,
+ cmListFileBacktrace const& /* context */)
+{
+ return tgt->GetSourcesProperty();
+}
+
+template <>
+const char* cmTargetPropertyComputer::ComputeLocationForBuild<
+ cmGeneratorTarget>(cmGeneratorTarget const* tgt)
+{
+ return tgt->GetLocation("");
+}
+
+template <>
+const char* cmTargetPropertyComputer::ComputeLocation<cmGeneratorTarget>(
+ cmGeneratorTarget const* tgt, const std::string& config)
+{
+ return tgt->GetLocation(config);
+}
+
class cmGeneratorTarget::TargetPropertyEntry
{
static cmLinkImplItem NoLinkImplItem;
@@ -320,6 +343,26 @@ cmGeneratorTarget::~cmGeneratorTarget()
cmDeleteAll(this->LinkInformation);
}
+const char* cmGeneratorTarget::GetSourcesProperty() const
+{
+ std::vector<std::string> values;
+ for (std::vector<cmGeneratorTarget::TargetPropertyEntry *>::const_iterator
+ it = this->SourceEntries.begin(),
+ end = this->SourceEntries.end();
+ it != end; ++it) {
+ values.push_back((*it)->ge->GetInput());
+ }
+ static std::string value;
+ value.clear();
+ value = cmJoin(values, "");
+ return value.c_str();
+}
+
+cmGlobalGenerator* cmGeneratorTarget::GetGlobalGenerator() const
+{
+ return this->GetLocalGenerator()->GetGlobalGenerator();
+}
+
cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const
{
return this->LocalGenerator;
@@ -354,6 +397,18 @@ std::string cmGeneratorTarget::GetExportName() const
const char* cmGeneratorTarget::GetProperty(const std::string& prop) const
{
+ if (!cmTargetPropertyComputer::PassesWhitelist(
+ this->GetType(), prop, this->Makefile->GetMessenger(),
+ this->GetBacktrace())) {
+ return 0;
+ }
+ if (const char* result = cmTargetPropertyComputer::GetProperty(
+ this, prop, this->Makefile->GetMessenger(), this->GetBacktrace())) {
+ return result;
+ }
+ if (cmSystemTools::GetFatalErrorOccured()) {
+ return CM_NULLPTR;
+ }
return this->Target->GetProperty(prop);
}
@@ -3966,7 +4021,7 @@ void cmGeneratorTarget::ComputeVersionedName(std::string& vName,
std::vector<std::string> cmGeneratorTarget::GetPropertyKeys() const
{
- cmPropertyMap propsObject = this->Target->GetProperties();
+ cmPropertyMap const& propsObject = this->Target->GetProperties();
std::vector<std::string> props;
props.reserve(propsObject.size());
for (cmPropertyMap::const_iterator it = propsObject.begin();