diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-08-04 17:19:42 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-08-05 16:20:44 (GMT) |
commit | 244c5b5dcdc5af1f91a79a81f7f7ec4047759fe8 (patch) | |
tree | fa37b061fa4f1326fcef64c408bfaca96b35036f /Source | |
parent | 12bc571c13eda8d504eac788d6b3e5e8d83e3ad3 (diff) | |
download | CMake-244c5b5dcdc5af1f91a79a81f7f7ec4047759fe8.zip CMake-244c5b5dcdc5af1f91a79a81f7f7ec4047759fe8.tar.gz CMake-244c5b5dcdc5af1f91a79a81f7f7ec4047759fe8.tar.bz2 |
cmGeneratorTarget: Move IsLinkInterfaceDependent* from cmTarget.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 27 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 81 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 26 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 88 | ||||
-rw-r--r-- | Source/cmTarget.h | 19 |
5 files changed, 122 insertions, 119 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index c0485db..c1641cc 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1128,6 +1128,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode } } + cmGeneratorTarget* gtgt = + context->Makefile->GetGlobalGenerator()->GetGeneratorTarget(target); + if (!prop) { if (target->IsImported() @@ -1135,16 +1138,16 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode { return linkedTargetsContent; } - if (target->IsLinkInterfaceDependentBoolProperty(propertyName, - context->Config)) + if (gtgt->IsLinkInterfaceDependentBoolProperty(propertyName, + context->Config)) { context->HadContextSensitiveCondition = true; return target->GetLinkInterfaceDependentBoolProperty( propertyName, context->Config) ? "1" : "0"; } - if (target->IsLinkInterfaceDependentStringProperty(propertyName, - context->Config)) + if (gtgt->IsLinkInterfaceDependentStringProperty(propertyName, + context->Config)) { context->HadContextSensitiveCondition = true; const char *propContent = @@ -1153,8 +1156,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode context->Config); return propContent ? propContent : ""; } - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) + if (gtgt->IsLinkInterfaceDependentNumberMinProperty(propertyName, + context->Config)) { context->HadContextSensitiveCondition = true; const char *propContent = @@ -1163,8 +1166,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode context->Config); return propContent ? propContent : ""; } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) + if (gtgt->IsLinkInterfaceDependentNumberMaxProperty(propertyName, + context->Config)) { context->HadContextSensitiveCondition = true; const char *propContent = @@ -1180,8 +1183,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode if (!target->IsImported() && dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()) { - if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName, - context->Config)) + if (gtgt->IsLinkInterfaceDependentNumberMinProperty(propertyName, + context->Config)) { context->HadContextSensitiveCondition = true; const char *propContent = @@ -1190,8 +1193,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode context->Config); return propContent ? propContent : ""; } - if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName, - context->Config)) + if (gtgt->IsLinkInterfaceDependentNumberMaxProperty(propertyName, + context->Config)) { context->HadContextSensitiveCondition = true; const char *propContent = diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 95f6aaa..3dbeff2 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1436,3 +1436,84 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const } } } + +//---------------------------------------------------------------------------- +const cmGeneratorTarget::CompatibleInterfacesBase& +cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const +{ + cmGeneratorTarget::CompatibleInterfaces& compat = + this->CompatibleInterfacesMap[config]; + if(!compat.Done) + { + compat.Done = true; + compat.PropsBool.insert("POSITION_INDEPENDENT_CODE"); + compat.PropsString.insert("AUTOUIC_OPTIONS"); + std::vector<cmTarget const*> const& deps = + this->Target->GetLinkImplementationClosure(config); + for(std::vector<cmTarget const*>::const_iterator li = deps.begin(); + li != deps.end(); ++li) + { +#define CM_READ_COMPATIBLE_INTERFACE(X, x) \ + if(const char* prop = (*li)->GetProperty("COMPATIBLE_INTERFACE_" #X)) \ + { \ + std::vector<std::string> props; \ + cmSystemTools::ExpandListArgument(prop, props); \ + compat.Props##x.insert(props.begin(), props.end()); \ + } + CM_READ_COMPATIBLE_INTERFACE(BOOL, Bool) + CM_READ_COMPATIBLE_INTERFACE(STRING, String) + CM_READ_COMPATIBLE_INTERFACE(NUMBER_MIN, NumberMin) + CM_READ_COMPATIBLE_INTERFACE(NUMBER_MAX, NumberMax) +#undef CM_READ_COMPATIBLE_INTERFACE + } + } + return compat; +} + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty( + const std::string &p, const std::string& config) const +{ + if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY + || this->Target->GetType() == cmTarget::INTERFACE_LIBRARY) + { + return false; + } + return this->GetCompatibleInterfaces(config).PropsBool.count(p) > 0; +} + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty( + const std::string &p, const std::string& config) const +{ + if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY + || this->Target->GetType() == cmTarget::INTERFACE_LIBRARY) + { + return false; + } + return this->GetCompatibleInterfaces(config).PropsString.count(p) > 0; +} + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty( + const std::string &p, const std::string& config) const +{ + if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY + || this->Target->GetType() == cmTarget::INTERFACE_LIBRARY) + { + return false; + } + return this->GetCompatibleInterfaces(config).PropsNumberMin.count(p) > 0; +} + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMaxProperty( + const std::string &p, const std::string& config) const +{ + if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY + || this->Target->GetType() == cmTarget::INTERFACE_LIBRARY) + { + return false; + } + return this->GetCompatibleInterfaces(config).PropsNumberMax.count(p) > 0; +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 3e43711..3b32bf5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -82,6 +82,15 @@ public: bool GetFeatureAsBool(const std::string& feature, const std::string& config) const; + bool IsLinkInterfaceDependentBoolProperty(const std::string &p, + const std::string& config) const; + bool IsLinkInterfaceDependentStringProperty(const std::string &p, + const std::string& config) const; + bool IsLinkInterfaceDependentNumberMinProperty(const std::string &p, + const std::string& config) const; + bool IsLinkInterfaceDependentNumberMaxProperty(const std::string &p, + const std::string& config) const; + /** Get the full path to the target according to the settings in its makefile and the configuration type. */ std::string GetFullPath(const std::string& config="", bool implib = false, @@ -187,6 +196,23 @@ private: mutable bool SourceFileFlagsConstructed; mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap; + struct CompatibleInterfacesBase + { + std::set<std::string> PropsBool; + std::set<std::string> PropsString; + std::set<std::string> PropsNumberMax; + std::set<std::string> PropsNumberMin; + }; + CompatibleInterfacesBase const& + GetCompatibleInterfaces(std::string const& config) const; + + struct CompatibleInterfaces: public CompatibleInterfacesBase + { + CompatibleInterfaces(): Done(false) {} + bool Done; + }; + mutable std::map<std::string, CompatibleInterfaces> CompatibleInterfacesMap; + cmGeneratorTarget(cmGeneratorTarget const&); void operator=(cmGeneratorTarget const&); }; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3074f9b..9c7e46a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -170,13 +170,6 @@ public: }; std::map<std::string, LinkImplClosure> LinkImplClosureMap; - struct CompatibleInterfaces: public cmTarget::CompatibleInterfaces - { - CompatibleInterfaces(): Done(false) {} - bool Done; - }; - std::map<std::string, CompatibleInterfaces> CompatibleInterfacesMap; - typedef std::map<std::string, std::vector<cmSourceFile*> > SourceFilesMapType; SourceFilesMapType SourceFilesMap; @@ -4991,54 +4984,6 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty( } //---------------------------------------------------------------------------- -bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p, - const std::string& config) const -{ - if (this->TargetTypeValue == OBJECT_LIBRARY - || this->TargetTypeValue == INTERFACE_LIBRARY) - { - return false; - } - return this->GetCompatibleInterfaces(config).PropsBool.count(p) > 0; -} - -//---------------------------------------------------------------------------- -bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p, - const std::string& config) const -{ - if (this->TargetTypeValue == OBJECT_LIBRARY - || this->TargetTypeValue == INTERFACE_LIBRARY) - { - return false; - } - return this->GetCompatibleInterfaces(config).PropsString.count(p) > 0; -} - -//---------------------------------------------------------------------------- -bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p, - const std::string& config) const -{ - if (this->TargetTypeValue == OBJECT_LIBRARY - || this->TargetTypeValue == INTERFACE_LIBRARY) - { - return false; - } - return this->GetCompatibleInterfaces(config).PropsNumberMin.count(p) > 0; -} - -//---------------------------------------------------------------------------- -bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p, - const std::string& config) const -{ - if (this->TargetTypeValue == OBJECT_LIBRARY - || this->TargetTypeValue == INTERFACE_LIBRARY) - { - return false; - } - return this->GetCompatibleInterfaces(config).PropsNumberMax.count(p) > 0; -} - -//---------------------------------------------------------------------------- void cmTarget::GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const { @@ -5725,39 +5670,6 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const } //---------------------------------------------------------------------------- -cmTarget::CompatibleInterfaces const& -cmTarget::GetCompatibleInterfaces(std::string const& config) const -{ - cmTargetInternals::CompatibleInterfaces& compat = - this->Internal->CompatibleInterfacesMap[config]; - if(!compat.Done) - { - compat.Done = true; - compat.PropsBool.insert("POSITION_INDEPENDENT_CODE"); - compat.PropsString.insert("AUTOUIC_OPTIONS"); - std::vector<cmTarget const*> const& deps = - this->GetLinkImplementationClosure(config); - for(std::vector<cmTarget const*>::const_iterator li = deps.begin(); - li != deps.end(); ++li) - { -#define CM_READ_COMPATIBLE_INTERFACE(X, x) \ - if(const char* prop = (*li)->GetProperty("COMPATIBLE_INTERFACE_" #X)) \ - { \ - std::vector<std::string> props; \ - cmSystemTools::ExpandListArgument(prop, props); \ - compat.Props##x.insert(props.begin(), props.end()); \ - } - CM_READ_COMPATIBLE_INTERFACE(BOOL, Bool) - CM_READ_COMPATIBLE_INTERFACE(STRING, String) - CM_READ_COMPATIBLE_INTERFACE(NUMBER_MIN, NumberMin) - CM_READ_COMPATIBLE_INTERFACE(NUMBER_MAX, NumberMax) -#undef CM_READ_COMPATIBLE_INTERFACE - } - } - return compat; -} - -//---------------------------------------------------------------------------- void cmTargetInternals::ComputeLinkInterfaceLibraries( cmTarget const* thisTarget, diff --git a/Source/cmTarget.h b/Source/cmTarget.h index d5374a6..df8cdc1 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -305,16 +305,6 @@ public: std::vector<cmTarget const*> const& GetLinkImplementationClosure(const std::string& config) const; - struct CompatibleInterfaces - { - std::set<std::string> PropsBool; - std::set<std::string> PropsString; - std::set<std::string> PropsNumberMax; - std::set<std::string> PropsNumberMin; - }; - CompatibleInterfaces const& - GetCompatibleInterfaces(std::string const& config) const; - /** The link implementation specifies the direct library dependencies needed by the object files of the target. */ struct LinkImplementationLibraries @@ -575,15 +565,6 @@ public: const std::string& config) const; bool IsNullImpliedByLinkLibraries(const std::string &p) const; - bool IsLinkInterfaceDependentBoolProperty(const std::string &p, - const std::string& config) const; - bool IsLinkInterfaceDependentStringProperty(const std::string &p, - const std::string& config) const; - bool IsLinkInterfaceDependentNumberMinProperty(const std::string &p, - const std::string& config) const; - bool IsLinkInterfaceDependentNumberMaxProperty(const std::string &p, - const std::string& config) const; - bool GetLinkInterfaceDependentBoolProperty(const std::string &p, const std::string& config) const; |