mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 07:08:38 -05:00
Add API to populate INTERFACE properties in exported targets.
The INTERFACE properties need to be preprocessed for context (build location or install location) and to extract target names etc.
This commit is contained in:
@@ -124,6 +124,65 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
|
||||
this->GenerateImportTargetsConfig(os, config, suffix);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
|
||||
const char *outputName,
|
||||
cmTarget *target,
|
||||
cmGeneratorExpression::PreprocessContext preprocessRule,
|
||||
ImportPropertyMap &properties,
|
||||
std::vector<std::string> &missingTargets)
|
||||
{
|
||||
const char *input = target->GetProperty(propName);
|
||||
if (input)
|
||||
{
|
||||
if (!*input)
|
||||
{
|
||||
// Set to empty
|
||||
properties[outputName] = "";
|
||||
return;
|
||||
}
|
||||
|
||||
std::string prepro = cmGeneratorExpression::Preprocess(input,
|
||||
preprocessRule);
|
||||
if (!prepro.empty())
|
||||
{
|
||||
this->ResolveTargetsInGeneratorExpressions(prepro, target,
|
||||
missingTargets);
|
||||
properties[outputName] = prepro;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
|
||||
cmTarget *target,
|
||||
cmGeneratorExpression::PreprocessContext preprocessRule,
|
||||
ImportPropertyMap &properties,
|
||||
std::vector<std::string> &missingTargets)
|
||||
{
|
||||
this->PopulateInterfaceProperty(propName, propName, target, preprocessRule,
|
||||
properties, missingTargets);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget *target,
|
||||
std::ostream& os,
|
||||
const ImportPropertyMap &properties)
|
||||
{
|
||||
if (!properties.empty())
|
||||
{
|
||||
std::string targetName = this->Namespace;
|
||||
targetName += target->GetName();
|
||||
os << "SET_TARGET_PROPERTIES(" << targetName << " PROPERTIES\n";
|
||||
for(ImportPropertyMap::const_iterator pi = properties.begin();
|
||||
pi != properties.end(); ++pi)
|
||||
{
|
||||
os << " " << pi->first << " \"" << pi->second << "\"\n";
|
||||
}
|
||||
os << ")\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
|
||||
|
||||
Reference in New Issue
Block a user