diff options
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 45 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.h | 14 |
2 files changed, 57 insertions, 2 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index da18856..df8f3e8 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -219,10 +219,55 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input, } //---------------------------------------------------------------------------- +static bool isGeneratorExpression(const std::string &lib) +{ + const std::string::size_type openpos = lib.find("$<"); + return (openpos != std::string::npos) + && (lib.find(">", openpos) != std::string::npos); +} + +//---------------------------------------------------------------------------- void cmExportFileGenerator::ResolveTargetsInGeneratorExpressions( std::string &input, cmTarget* target, + std::vector<std::string> &missingTargets, + FreeTargetsReplace replace) +{ + if (replace == NoReplaceFreeTargets) + { + this->ResolveTargetsInGeneratorExpression(input, target, missingTargets); + return; + } + std::vector<std::string> parts; + cmGeneratorExpression::Split(input, parts); + + std::string sep; + input = ""; + for(std::vector<std::string>::iterator li = parts.begin(); + li != parts.end(); ++li) + { + if (!isGeneratorExpression(*li)) + { + this->AddTargetNamespace(*li, target, missingTargets); + } + else + { + this->ResolveTargetsInGeneratorExpression( + *li, + target, + missingTargets); + } + input += sep + *li; + sep = ";"; + } +} + +//---------------------------------------------------------------------------- +void +cmExportFileGenerator::ResolveTargetsInGeneratorExpression( + std::string &input, + cmTarget* target, std::vector<std::string> &missingTargets) { std::string::size_type pos = 0; diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index a5b25f4..866806b 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -102,9 +102,16 @@ protected: void GenerateInterfaceProperties(cmTarget *target, std::ostream& os, const ImportPropertyMap &properties); + + enum FreeTargetsReplace { + ReplaceFreeTargets, + NoReplaceFreeTargets + }; + void ResolveTargetsInGeneratorExpressions(std::string &input, - cmTarget* target, - std::vector<std::string> &missingTargets); + cmTarget* target, + std::vector<std::string> &missingTargets, + FreeTargetsReplace replace = NoReplaceFreeTargets); // The namespace in which the exports are placed in the generated file. std::string Namespace; @@ -132,6 +139,9 @@ private: bool AddTargetNamespace(std::string &input, cmTarget* target, std::vector<std::string> &missingTargets); + void ResolveTargetsInGeneratorExpression(std::string &input, + cmTarget* target, + std::vector<std::string> &missingTargets); }; #endif |