Commit fa9dbc56 authored by Stephen Kelly's avatar Stephen Kelly
Browse files

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.
parent 848ae2a6
......@@ -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
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()
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) {
static std::string value;
value = cmJoin(values, "");
return value.c_str();
cmGlobalGenerator* cmGeneratorTarget::GetGlobalGenerator() const
return this->GetLocalGenerator()->GetGlobalGenerator();
......@@ -532,6 +532,8 @@ public:
std::string GetFortranModuleDirectory(std::string const& working_dir) const;
const char* GetSourcesProperty() const;
void AddSourceCommon(const std::string& src);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment