cmGeneratorTarget: Move ReportPropertyOrigin from cmTarget.

This commit is contained in:
Stephen Kelly 2015-08-04 19:19:44 +02:00
parent 4b86f5edc9
commit 97f10e488a
4 changed files with 57 additions and 56 deletions

View File

@ -1937,24 +1937,24 @@ std::pair<bool, const char*> consistentProperty(const char *lhs,
//----------------------------------------------------------------------------
template<typename PropertyType>
PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
const std::string &p,
const std::string& config,
const char *defaultValue,
CompatibleType t,
PropertyType *)
{
PropertyType propContent = getTypedProperty<PropertyType>(tgt, p);
const bool explicitlySet = tgt->GetProperties()
PropertyType propContent = getTypedProperty<PropertyType>(tgt->Target, p);
const bool explicitlySet = tgt->Target->GetProperties()
.find(p)
!= tgt->GetProperties().end();
!= tgt->Target->GetProperties().end();
const bool impliedByUse =
tgt->IsNullImpliedByLinkLibraries(p);
tgt->Target->IsNullImpliedByLinkLibraries(p);
assert((impliedByUse ^ explicitlySet)
|| (!impliedByUse && !explicitlySet));
std::vector<cmTarget const*> const& deps =
tgt->GetLinkImplementationClosure(config);
tgt->Target->GetLinkImplementationClosure(config);
if(deps.empty())
{
@ -2125,7 +2125,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
bool cmGeneratorTarget::GetLinkInterfaceDependentBoolProperty(
const std::string &p, const std::string& config) const
{
return checkInterfacePropertyCompatibility<bool>(this->Target, p, config,
return checkInterfacePropertyCompatibility<bool>(this, p, config,
"FALSE",
BoolType, 0);
}
@ -2135,7 +2135,7 @@ const char* cmGeneratorTarget::GetLinkInterfaceDependentStringProperty(
const std::string &p,
const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char *>(this->Target,
return checkInterfacePropertyCompatibility<const char *>(this,
p,
config,
"empty",
@ -2147,7 +2147,7 @@ const char * cmGeneratorTarget::GetLinkInterfaceDependentNumberMinProperty(
const std::string &p,
const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char *>(this->Target,
return checkInterfacePropertyCompatibility<const char *>(this,
p,
config,
"empty",
@ -2159,7 +2159,7 @@ const char * cmGeneratorTarget::GetLinkInterfaceDependentNumberMaxProperty(
const std::string &p,
const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char *>(this->Target,
return checkInterfacePropertyCompatibility<const char *>(this,
p,
config,
"empty",
@ -2196,3 +2196,43 @@ cmGeneratorTarget::GetLinkInformation(const std::string& config) const
}
return i->second;
}
//----------------------------------------------------------------------------
void
cmGeneratorTarget::ReportPropertyOrigin(const std::string &p,
const std::string &result,
const std::string &report,
const std::string &compatibilityType) const
{
std::vector<std::string> debugProperties;
const char *debugProp = this->Target->GetMakefile()
->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
if (debugProp)
{
cmSystemTools::ExpandListArgument(debugProp, debugProperties);
}
bool debugOrigin = !this->DebugCompatiblePropertiesDone[p]
&& std::find(debugProperties.begin(),
debugProperties.end(),
p)
!= debugProperties.end();
if (this->Target->GetMakefile()->IsConfigured())
{
this->DebugCompatiblePropertiesDone[p] = true;
}
if (!debugOrigin)
{
return;
}
std::string areport = compatibilityType;
areport += std::string(" of property \"") + p + "\" for target \"";
areport += std::string(this->GetName());
areport += "\" (result: \"";
areport += result;
areport += "\"):\n" + report;
this->Makefile->GetCMakeInstance()->IssueMessage(cmake::LOG, areport);
}

View File

@ -199,6 +199,11 @@ public:
std::vector<cmSourceFile const*> XamlSources;
};
void ReportPropertyOrigin(const std::string &p,
const std::string &result,
const std::string &report,
const std::string &compatibilityType) const;
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
@ -212,6 +217,8 @@ private:
mutable bool SourceFileFlagsConstructed;
mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
struct CompatibleInterfacesBase
{
std::set<std::string> PropsBool;

View File

@ -4535,46 +4535,6 @@ bool cmTarget::IsNullImpliedByLinkLibraries(const std::string &p) const
!= this->LinkImplicitNullProperties.end();
}
//----------------------------------------------------------------------------
void
cmTarget::ReportPropertyOrigin(const std::string &p,
const std::string &result,
const std::string &report,
const std::string &compatibilityType) const
{
std::vector<std::string> debugProperties;
const char *debugProp =
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
if (debugProp)
{
cmSystemTools::ExpandListArgument(debugProp, debugProperties);
}
bool debugOrigin = !this->DebugCompatiblePropertiesDone[p]
&& std::find(debugProperties.begin(),
debugProperties.end(),
p)
!= debugProperties.end();
if (this->Makefile->IsConfigured())
{
this->DebugCompatiblePropertiesDone[p] = true;
}
if (!debugOrigin)
{
return;
}
std::string areport = compatibilityType;
areport += std::string(" of property \"") + p + "\" for target \"";
areport += std::string(this->GetName());
areport += "\" (result: \"";
areport += result;
areport += "\"):\n" + report;
this->Makefile->GetCMakeInstance()->IssueMessage(cmake::LOG, areport);
}
//----------------------------------------------------------------------------
void
cmTarget::GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const

View File

@ -565,11 +565,6 @@ public:
bool LinkLanguagePropagatesToDependents() const
{ return this->TargetTypeValue == STATIC_LIBRARY; }
void ReportPropertyOrigin(const std::string &p,
const std::string &result,
const std::string &report,
const std::string &compatibilityType) const;
std::map<std::string, std::string> const&
GetMaxLanguageStandards() const
{
@ -676,7 +671,6 @@ private:
std::set<std::string> Utilities;
mutable std::set<std::string> LinkImplicitNullProperties;
std::map<std::string, cmListFileBacktrace> UtilityBacktraces;
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
mutable std::map<std::string, std::string> MaxLanguageStandards;
cmPolicies::PolicyMap PolicyMap;
std::string Name;