MCPcopy Create free account
hub / github.com/Kitware/CMake / PopulateExportProperties

Method PopulateExportProperties

Source/cmExportFileGenerator.cxx:777–815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

775}
776
777bool 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}

Callers 1

Calls 4

cmHasLiteralPrefixFunction · 0.85
GetPropertyValueMethod · 0.80
strMethod · 0.80
GetNameMethod · 0.45

Tested by

no test coverage detected