diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-01-06 12:49:20 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-01-24 19:36:04 (GMT) |
commit | 2fb2c32f9b304bc71b039754f9b9170fd6f27a6f (patch) | |
tree | 6afedbc38336f2cc032b81051fd3b9cadc23d5aa /Source | |
parent | cd66b9131d76984795c8a77353d6afa33abb54f7 (diff) | |
download | CMake-2fb2c32f9b304bc71b039754f9b9170fd6f27a6f.zip CMake-2fb2c32f9b304bc71b039754f9b9170fd6f27a6f.tar.gz CMake-2fb2c32f9b304bc71b039754f9b9170fd6f27a6f.tar.bz2 |
Add the COMPATIBLE_INTERFACE_STRING property.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 7 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 65 | ||||
-rw-r--r-- | Source/cmTarget.h | 5 |
4 files changed, 83 insertions, 0 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index ef1fc5f..96e0aea 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -217,6 +217,9 @@ void getCompatibleInterfaceProperties(cmTarget *target, getPropertyContents(li->Target, "COMPATIBLE_INTERFACE_BOOL", ifaceProperties); + getPropertyContents(li->Target, + "COMPATIBLE_INTERFACE_STRING", + ifaceProperties); } } @@ -227,10 +230,13 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( { this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL", target, properties); + this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_STRING", + target, properties); std::set<std::string> ifaceProperties; getPropertyContents(target, "COMPATIBLE_INTERFACE_BOOL", ifaceProperties); + getPropertyContents(target, "COMPATIBLE_INTERFACE_STRING", ifaceProperties); getCompatibleInterfaceProperties(target, ifaceProperties, 0); diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index c468c39..0c61a12 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -462,6 +462,13 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode propertyName, context->Config) ? "1" : "0"; } + if (target->IsLinkInterfaceDependentStringProperty(propertyName, + context->Config)) + { + return target->GetLinkInterfaceDependentStringProperty( + propertyName, + context->Config); + } return std::string(); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d2839c5..e3be510 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -908,6 +908,17 @@ void cmTarget::DefineProperties(cmake *cm) "property is not set, then it is ignored."); cm->DefineProperty + ("COMPATIBLE_INTERFACE_STRING", cmProperty::TARGET, + "Properties which must be string-compatible with their link interface", + "The COMPATIBLE_INTERFACE_STRING property may contain a list of " + "properties for this target which must be the same when evaluated as " + "a string in the INTERFACE of all linked dependencies. For example, " + "if a property \"FOO\" appears in the list, then the \"INTERFACE_FOO\" " + "property content in all dependencies must be equal with each " + "other, and with the \"FOO\" property in this target. If the " + "property is not set, then it is ignored."); + + cm->DefineProperty ("POST_INSTALL_SCRIPT", cmProperty::TARGET, "Deprecated install support.", "The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the " @@ -4512,6 +4523,14 @@ bool getTypedProperty<bool>(cmTarget *tgt, const char *prop, bool *) } //---------------------------------------------------------------------------- +template<> +const char *getTypedProperty<const char *>(cmTarget *tgt, const char *prop, + const char **) +{ + return tgt->GetProperty(prop); +} + +//---------------------------------------------------------------------------- template<typename PropertyType> bool consistentProperty(PropertyType lhs, PropertyType rhs); @@ -4523,6 +4542,17 @@ bool consistentProperty(bool lhs, bool rhs) } //---------------------------------------------------------------------------- +template<> +bool consistentProperty(const char *lhs, const char *rhs) +{ + if (!lhs && !rhs) + return true; + if (!lhs || !rhs) + return false; + return strcmp(lhs, rhs) == 0; +} + +//---------------------------------------------------------------------------- template<typename PropertyType> PropertyType checkInterfacePropertyCompatibility(cmTarget *tgt, const std::string &p, @@ -4668,6 +4698,17 @@ bool cmTarget::GetLinkInterfaceDependentBoolProperty(const std::string &p, } //---------------------------------------------------------------------------- +const char * cmTarget::GetLinkInterfaceDependentStringProperty( + const std::string &p, + const char *config) +{ + return checkInterfacePropertyCompatibility<const char *>(this, + p, + config, + "empty", 0); +} + +//---------------------------------------------------------------------------- bool isLinkDependentProperty(cmTarget *tgt, const std::string &p, const char *interfaceProperty, const char *config) @@ -4715,6 +4756,14 @@ bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p, } //---------------------------------------------------------------------------- +bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p, + const char *config) +{ + return isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_STRING", + config); +} + +//---------------------------------------------------------------------------- void cmTarget::GetLanguages(std::set<cmStdString>& languages) const { for(std::vector<cmSourceFile*>::const_iterator @@ -5468,6 +5517,15 @@ bool getLinkInterfaceDependentProperty(cmTarget *tgt, return tgt->GetLinkInterfaceDependentBoolProperty(prop, config); } +template<> +const char * getLinkInterfaceDependentProperty(cmTarget *tgt, + const std::string prop, + const char *config, + const char **) +{ + return tgt->GetLinkInterfaceDependentStringProperty(prop, config); +} + //---------------------------------------------------------------------------- template<typename PropertyType> void checkPropertyConsistency(cmTarget *depender, cmTarget *dependee, @@ -5536,6 +5594,13 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, { return; } + checkPropertyConsistency<const char *>(this, li->Target, + "COMPATIBLE_INTERFACE_STRING", + emitted, config, 0); + if (cmSystemTools::GetErrorOccuredFlag()) + { + return; + } } } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 9909bae..4457bec 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -501,12 +501,17 @@ public: bool IsNullImpliedByLinkLibraries(const std::string &p); bool IsLinkInterfaceDependentBoolProperty(const std::string &p, const char *config); + bool IsLinkInterfaceDependentStringProperty(const std::string &p, + const char *config); void AddLinkDependentTargetsForProperties( const std::map<cmStdString, cmStdString> &map); bool GetLinkInterfaceDependentBoolProperty(const std::string &p, const char *config); + + const char *GetLinkInterfaceDependentStringProperty(const std::string &p, + const char *config); private: /** * A list of direct dependencies. Use in conjunction with DependencyMap. |