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> template<typename PropertyType>
PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
const std::string &p, const std::string &p,
const std::string& config, const std::string& config,
const char *defaultValue, const char *defaultValue,
CompatibleType t, CompatibleType t,
PropertyType *) PropertyType *)
{ {
PropertyType propContent = getTypedProperty<PropertyType>(tgt, p); PropertyType propContent = getTypedProperty<PropertyType>(tgt->Target, p);
const bool explicitlySet = tgt->GetProperties() const bool explicitlySet = tgt->Target->GetProperties()
.find(p) .find(p)
!= tgt->GetProperties().end(); != tgt->Target->GetProperties().end();
const bool impliedByUse = const bool impliedByUse =
tgt->IsNullImpliedByLinkLibraries(p); tgt->Target->IsNullImpliedByLinkLibraries(p);
assert((impliedByUse ^ explicitlySet) assert((impliedByUse ^ explicitlySet)
|| (!impliedByUse && !explicitlySet)); || (!impliedByUse && !explicitlySet));
std::vector<cmTarget const*> const& deps = std::vector<cmTarget const*> const& deps =
tgt->GetLinkImplementationClosure(config); tgt->Target->GetLinkImplementationClosure(config);
if(deps.empty()) if(deps.empty())
{ {
@ -2125,7 +2125,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
bool cmGeneratorTarget::GetLinkInterfaceDependentBoolProperty( bool cmGeneratorTarget::GetLinkInterfaceDependentBoolProperty(
const std::string &p, const std::string& config) const const std::string &p, const std::string& config) const
{ {
return checkInterfacePropertyCompatibility<bool>(this->Target, p, config, return checkInterfacePropertyCompatibility<bool>(this, p, config,
"FALSE", "FALSE",
BoolType, 0); BoolType, 0);
} }
@ -2135,7 +2135,7 @@ const char* cmGeneratorTarget::GetLinkInterfaceDependentStringProperty(
const std::string &p, const std::string &p,
const std::string& config) const const std::string& config) const
{ {
return checkInterfacePropertyCompatibility<const char *>(this->Target, return checkInterfacePropertyCompatibility<const char *>(this,
p, p,
config, config,
"empty", "empty",
@ -2147,7 +2147,7 @@ const char * cmGeneratorTarget::GetLinkInterfaceDependentNumberMinProperty(
const std::string &p, const std::string &p,
const std::string& config) const const std::string& config) const
{ {
return checkInterfacePropertyCompatibility<const char *>(this->Target, return checkInterfacePropertyCompatibility<const char *>(this,
p, p,
config, config,
"empty", "empty",
@ -2159,7 +2159,7 @@ const char * cmGeneratorTarget::GetLinkInterfaceDependentNumberMaxProperty(
const std::string &p, const std::string &p,
const std::string& config) const const std::string& config) const
{ {
return checkInterfacePropertyCompatibility<const char *>(this->Target, return checkInterfacePropertyCompatibility<const char *>(this,
p, p,
config, config,
"empty", "empty",
@ -2196,3 +2196,43 @@ cmGeneratorTarget::GetLinkInformation(const std::string& config) const
} }
return i->second; 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; 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: private:
friend class cmTargetTraceDependencies; friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; }; struct SourceEntry { std::vector<cmSourceFile*> Depends; };
@ -212,6 +217,8 @@ private:
mutable bool SourceFileFlagsConstructed; mutable bool SourceFileFlagsConstructed;
mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap; mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
struct CompatibleInterfacesBase struct CompatibleInterfacesBase
{ {
std::set<std::string> PropsBool; std::set<std::string> PropsBool;

View File

@ -4535,46 +4535,6 @@ bool cmTarget::IsNullImpliedByLinkLibraries(const std::string &p) const
!= this->LinkImplicitNullProperties.end(); != 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 void
cmTarget::GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const cmTarget::GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const

View File

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