summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.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-15 09:14:21 (GMT)
commitfa9dbc56a15aec71ac2eda7890efd0116797f373 (patch)
tree21fbf0e013ec0e574b5e29792267e0751e6b1abb /Source/cmGeneratorTarget.cxx
parent848ae2a663ef83e059561d94b33d551154642231 (diff)
downloadCMake-fa9dbc56a15aec71ac2eda7890efd0116797f373.zip
CMake-fa9dbc56a15aec71ac2eda7890efd0116797f373.tar.gz
CMake-fa9dbc56a15aec71ac2eda7890efd0116797f373.tar.bz2
cmGeneratorTarget: Implement cmTargetPropertyComputer interface
Populate a local member for the sources property when the instance is created. Pass the parameter to avoid the policy check when doing so. Ordinarily, the GetSources function should not be called unconditionally (at generate time), but we need to do so here in case the property is read in a generator expression. The intent is to be able to implement cmGeneratorTarget without requiring cmTarget.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index fb732a6..050fcb8 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,21 @@ 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();