| 775 | } |
| 776 | |
| 777 | bool cmExportFileGenerator::PopulateExportProperties( |
| 778 | cmGeneratorTarget const* gte, ImportPropertyMap& properties, |
| 779 | std::string& errorMessage) const |
| 780 | { |
| 781 | auto const& targetProperties = gte->Target->GetProperties(); |
| 782 | if (cmValue exportProperties = |
| 783 | targetProperties.GetPropertyValue("EXPORT_PROPERTIES")) { |
| 784 | for (auto& prop : cmList{ *exportProperties }) { |
| 785 | /* Black list reserved properties */ |
| 786 | if (cmHasLiteralPrefix(prop, "IMPORTED_") || |
| 787 | cmHasLiteralPrefix(prop, "INTERFACE_")) { |
| 788 | std::ostringstream e; |
| 789 | e << "Target \"" << gte->Target->GetName() << "\" contains property \"" |
| 790 | << prop << "\" in EXPORT_PROPERTIES but IMPORTED_* and INTERFACE_* " |
| 791 | << "properties are reserved."; |
| 792 | errorMessage = e.str(); |
| 793 | return false; |
| 794 | } |
| 795 | cmValue propertyValue = targetProperties.GetPropertyValue(prop); |
| 796 | if (!propertyValue) { |
| 797 | // Asked to export a property that isn't defined on the target. Do not |
| 798 | // consider this an error, there's just nothing to export. |
| 799 | continue; |
| 800 | } |
| 801 | std::string evaluatedValue = cmGeneratorExpression::Preprocess( |
| 802 | *propertyValue, cmGeneratorExpression::StripAllGeneratorExpressions); |
| 803 | if (evaluatedValue != *propertyValue) { |
| 804 | std::ostringstream e; |
| 805 | e << "Target \"" << gte->Target->GetName() << "\" contains property \"" |
| 806 | << prop << "\" in EXPORT_PROPERTIES but this property contains a " |
| 807 | << "generator expression. This is not allowed."; |
| 808 | errorMessage = e.str(); |
| 809 | return false; |
| 810 | } |
| 811 | properties[prop] = *propertyValue; |
| 812 | } |
| 813 | } |
| 814 | return true; |
| 815 | } |
no test coverage detected