diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-01-20 16:09:29 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-01-21 08:05:03 (GMT) |
commit | 830246e841d24cc9513c857859a4327ffb1d3da5 (patch) | |
tree | 7af58ecf6a34cc50036af30669cb7207c04a9760 /Source | |
parent | bd82bb4787410a0bdd6120b8c449f5d31ecc4c28 (diff) | |
download | CMake-830246e841d24cc9513c857859a4327ffb1d3da5.zip CMake-830246e841d24cc9513c857859a4327ffb1d3da5.tar.gz CMake-830246e841d24cc9513c857859a4327ffb1d3da5.tar.bz2 |
Export the COMPATIBLE_INTERFACE_BOOL content properties
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExportBuildFileGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 74 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmExportInstallFileGenerator.cxx | 1 |
4 files changed, 78 insertions, 0 deletions
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 61e130d..7147f86 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -74,6 +74,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", te, properties); + this->PopulateCompatibleInterfaceProperties(te, properties); this->GenerateInterfaceProperties(te, os, properties); } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 4a7c6f9..3a6294a 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -21,6 +21,7 @@ #include "cmTarget.h" #include "cmTargetExport.h" #include "cmVersion.h" +#include "cmComputeLinkInformation.h" #include <cmsys/auto_ptr.hxx> @@ -177,6 +178,79 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, properties, missingTargets); } + +//---------------------------------------------------------------------------- +void getPropertyContents(cmTarget *tgt, const char *prop, + std::set<std::string> &ifaceProperties) +{ + const char *p = tgt->GetProperty(prop); + if (!p) + { + return; + } + std::vector<std::string> content; + cmSystemTools::ExpandListArgument(p, content); + for (std::vector<std::string>::const_iterator ci = content.begin(); + ci != content.end(); ++ci) + { + ifaceProperties.insert(*ci); + } +} + +//---------------------------------------------------------------------------- +void getCompatibleInterfaceProperties(cmTarget *target, + std::set<std::string> &ifaceProperties, + const char *config) +{ + cmComputeLinkInformation *info = target->GetLinkInformation(config); + + const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); + + for(cmComputeLinkInformation::ItemVector::const_iterator li = + deps.begin(); + li != deps.end(); ++li) + { + if (!li->Target) + { + continue; + } + getPropertyContents(li->Target, + "COMPATIBLE_INTERFACE_BOOL", + ifaceProperties); + } +} + +//---------------------------------------------------------------------------- +void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( + cmTarget *target, + ImportPropertyMap &properties) +{ + this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL", + target, properties); + + std::set<std::string> ifaceProperties; + + getPropertyContents(target, "COMPATIBLE_INTERFACE_BOOL", ifaceProperties); + + getCompatibleInterfaceProperties(target, ifaceProperties, 0); + + std::vector<std::string> configNames; + target->GetMakefile()->GetConfigurations(configNames); + + for (std::vector<std::string>::const_iterator ci = configNames.begin(); + ci != configNames.end(); ++ci) + { + getCompatibleInterfaceProperties(target, ifaceProperties, ci->c_str()); + } + + for (std::set<std::string>::const_iterator it = ifaceProperties.begin(); + it != ifaceProperties.end(); ++it) + { + this->PopulateInterfaceProperty(("INTERFACE_" + *it).c_str(), + target, properties); + } +} + //---------------------------------------------------------------------------- void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget *target, std::ostream& os, diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index eb3f3c3..b39df0f 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -103,6 +103,8 @@ protected: std::vector<std::string> &missingTargets); void PopulateInterfaceProperty(const char *propName, cmTarget *target, ImportPropertyMap &properties); + void PopulateCompatibleInterfaceProperties(cmTarget *target, + ImportPropertyMap &properties); void GenerateInterfaceProperties(cmTarget *target, std::ostream& os, const ImportPropertyMap &properties); diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 965f63d..526a6be 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -91,6 +91,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", te, properties); + this->PopulateCompatibleInterfaceProperties(te, properties); this->GenerateInterfaceProperties(te, os, properties); } |