mirror of
https://github.com/reactos/CMake.git
synced 2024-11-28 14:01:21 +00:00
Export: Port interface to cmGeneratorTarget.
This commit is contained in:
parent
1293c1561a
commit
6a72b3c84e
@ -50,7 +50,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
|
||||
->FindGeneratorTargetToUse(*tei);
|
||||
expectedTargets += sep + this->Namespace + te->Target->GetExportName();
|
||||
sep = " ";
|
||||
if(this->ExportedTargets.insert(te->Target).second)
|
||||
if(this->ExportedTargets.insert(te).second)
|
||||
{
|
||||
this->Exports.push_back(te);
|
||||
}
|
||||
@ -80,45 +80,44 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
|
||||
tei != this->Exports.end(); ++tei)
|
||||
{
|
||||
cmGeneratorTarget* gte = *tei;
|
||||
cmTarget* te = gte->Target;
|
||||
this->GenerateImportTargetCode(os, te);
|
||||
this->GenerateImportTargetCode(os, gte);
|
||||
|
||||
te->AppendBuildInterfaceIncludes();
|
||||
gte->Target->AppendBuildInterfaceIncludes();
|
||||
|
||||
ImportPropertyMap properties;
|
||||
|
||||
this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", te,
|
||||
this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", gte,
|
||||
cmGeneratorExpression::BuildInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_SOURCES", te,
|
||||
this->PopulateInterfaceProperty("INTERFACE_SOURCES", gte,
|
||||
cmGeneratorExpression::BuildInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", te,
|
||||
this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", gte,
|
||||
cmGeneratorExpression::BuildInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS", te,
|
||||
this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS", gte,
|
||||
cmGeneratorExpression::BuildInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS", te,
|
||||
this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS", gte,
|
||||
cmGeneratorExpression::BuildInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", te,
|
||||
this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", gte,
|
||||
cmGeneratorExpression::BuildInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
|
||||
te, properties);
|
||||
gte, properties);
|
||||
const bool newCMP0022Behavior =
|
||||
te->GetPolicyStatusCMP0022() != cmPolicies::WARN
|
||||
&& te->GetPolicyStatusCMP0022() != cmPolicies::OLD;
|
||||
gte->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN
|
||||
&& gte->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
|
||||
if (newCMP0022Behavior)
|
||||
{
|
||||
this->PopulateInterfaceLinkLibrariesProperty(te,
|
||||
this->PopulateInterfaceLinkLibrariesProperty(gte,
|
||||
cmGeneratorExpression::BuildInterface,
|
||||
properties, missingTargets);
|
||||
}
|
||||
this->PopulateCompatibleInterfaceProperties(gte, properties);
|
||||
|
||||
this->GenerateInterfaceProperties(te, os, properties);
|
||||
this->GenerateInterfaceProperties(gte, os, properties);
|
||||
}
|
||||
|
||||
// Generate import file content for each configuration.
|
||||
|
@ -155,7 +155,7 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
|
||||
//----------------------------------------------------------------------------
|
||||
void cmExportFileGenerator::PopulateInterfaceProperty(
|
||||
const std::string& propName,
|
||||
cmTarget *target,
|
||||
cmGeneratorTarget *target,
|
||||
ImportPropertyMap &properties)
|
||||
{
|
||||
const char *input = target->GetProperty(propName);
|
||||
@ -169,7 +169,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty(
|
||||
void cmExportFileGenerator::PopulateInterfaceProperty(
|
||||
const std::string& propName,
|
||||
const std::string& outputName,
|
||||
cmTarget *target,
|
||||
cmGeneratorTarget *target,
|
||||
cmGeneratorExpression::PreprocessContext preprocessRule,
|
||||
ImportPropertyMap &properties,
|
||||
std::vector<std::string> &missingTargets)
|
||||
@ -206,12 +206,12 @@ void cmExportFileGenerator::GenerateRequiredCMakeVersion(std::ostream& os,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty(
|
||||
cmTarget *target,
|
||||
cmGeneratorTarget *target,
|
||||
cmGeneratorExpression::PreprocessContext preprocessRule,
|
||||
ImportPropertyMap &properties,
|
||||
std::vector<std::string> &missingTargets)
|
||||
{
|
||||
if(!target->IsLinkable())
|
||||
if(!target->Target->IsLinkable())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -420,7 +420,7 @@ void cmExportFileGenerator::PopulateSourcesInterface(
|
||||
true);
|
||||
if (!prepro.empty())
|
||||
{
|
||||
this->ResolveTargetsInGeneratorExpressions(prepro, gt->Target,
|
||||
this->ResolveTargetsInGeneratorExpressions(prepro, gt,
|
||||
missingTargets);
|
||||
|
||||
if (!checkInterfaceDirs(prepro, gt, propName))
|
||||
@ -488,7 +488,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
|
||||
true);
|
||||
if (!prepro.empty())
|
||||
{
|
||||
this->ResolveTargetsInGeneratorExpressions(prepro, target->Target,
|
||||
this->ResolveTargetsInGeneratorExpressions(prepro, target,
|
||||
missingTargets);
|
||||
|
||||
if (!checkInterfaceDirs(prepro, target, propName))
|
||||
@ -502,7 +502,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
|
||||
//----------------------------------------------------------------------------
|
||||
void cmExportFileGenerator::PopulateInterfaceProperty(
|
||||
const std::string& propName,
|
||||
cmTarget *target,
|
||||
cmGeneratorTarget* target,
|
||||
cmGeneratorExpression::PreprocessContext preprocessRule,
|
||||
ImportPropertyMap &properties,
|
||||
std::vector<std::string> &missingTargets)
|
||||
@ -574,15 +574,14 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
|
||||
cmGeneratorTarget *gtarget,
|
||||
ImportPropertyMap &properties)
|
||||
{
|
||||
cmTarget *target = gtarget->Target;
|
||||
this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL",
|
||||
target, properties);
|
||||
gtarget, properties);
|
||||
this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_STRING",
|
||||
target, properties);
|
||||
gtarget, properties);
|
||||
this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_NUMBER_MIN",
|
||||
target, properties);
|
||||
gtarget, properties);
|
||||
this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_NUMBER_MAX",
|
||||
target, properties);
|
||||
gtarget, properties);
|
||||
|
||||
std::set<std::string> ifaceProperties;
|
||||
|
||||
@ -593,12 +592,12 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
|
||||
getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MAX",
|
||||
ifaceProperties);
|
||||
|
||||
if (target->GetType() != cmState::INTERFACE_LIBRARY)
|
||||
if (gtarget->GetType() != cmState::INTERFACE_LIBRARY)
|
||||
{
|
||||
getCompatibleInterfaceProperties(gtarget, ifaceProperties, "");
|
||||
|
||||
std::vector<std::string> configNames;
|
||||
target->GetMakefile()->GetConfigurations(configNames);
|
||||
gtarget->Target->GetMakefile()->GetConfigurations(configNames);
|
||||
|
||||
for (std::vector<std::string>::const_iterator ci = configNames.begin();
|
||||
ci != configNames.end(); ++ci)
|
||||
@ -611,19 +610,20 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
|
||||
it != ifaceProperties.end(); ++it)
|
||||
{
|
||||
this->PopulateInterfaceProperty("INTERFACE_" + *it,
|
||||
target, properties);
|
||||
gtarget, properties);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target,
|
||||
void cmExportFileGenerator::GenerateInterfaceProperties(
|
||||
const cmGeneratorTarget* target,
|
||||
std::ostream& os,
|
||||
const ImportPropertyMap &properties)
|
||||
{
|
||||
if (!properties.empty())
|
||||
{
|
||||
std::string targetName = this->Namespace;
|
||||
targetName += target->GetExportName();
|
||||
targetName += target->Target->GetExportName();
|
||||
os << "set_target_properties(" << targetName << " PROPERTIES\n";
|
||||
for(ImportPropertyMap::const_iterator pi = properties.begin();
|
||||
pi != properties.end(); ++pi)
|
||||
@ -638,12 +638,12 @@ void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target,
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
cmExportFileGenerator::AddTargetNamespace(std::string &input,
|
||||
cmTarget* target,
|
||||
cmGeneratorTarget* target,
|
||||
std::vector<std::string> &missingTargets)
|
||||
{
|
||||
cmMakefile *mf = target->GetMakefile();
|
||||
cmLocalGenerator *lg = target->GetLocalGenerator();
|
||||
|
||||
cmTarget *tgt = mf->FindTargetToUse(input);
|
||||
cmGeneratorTarget *tgt = lg->FindGeneratorTargetToUse(input);
|
||||
if (!tgt)
|
||||
{
|
||||
return false;
|
||||
@ -655,13 +655,14 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input,
|
||||
}
|
||||
if(this->ExportedTargets.find(tgt) != this->ExportedTargets.end())
|
||||
{
|
||||
input = this->Namespace + tgt->GetExportName();
|
||||
input = this->Namespace + tgt->Target->GetExportName();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string namespacedTarget;
|
||||
this->HandleMissingTarget(namespacedTarget, missingTargets,
|
||||
mf, target, tgt);
|
||||
target->Target->GetMakefile(),
|
||||
target->Target, tgt->Target);
|
||||
if (!namespacedTarget.empty())
|
||||
{
|
||||
input = namespacedTarget;
|
||||
@ -674,7 +675,7 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input,
|
||||
void
|
||||
cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
|
||||
std::string &input,
|
||||
cmTarget* target,
|
||||
cmGeneratorTarget* target,
|
||||
std::vector<std::string> &missingTargets,
|
||||
FreeTargetsReplace replace)
|
||||
{
|
||||
@ -711,14 +712,12 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
|
||||
void
|
||||
cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
|
||||
std::string &input,
|
||||
cmTarget* target,
|
||||
cmGeneratorTarget* target,
|
||||
std::vector<std::string> &missingTargets)
|
||||
{
|
||||
std::string::size_type pos = 0;
|
||||
std::string::size_type lastPos = pos;
|
||||
|
||||
cmMakefile *mf = target->GetMakefile();
|
||||
|
||||
while((pos = input.find("$<TARGET_PROPERTY:", lastPos)) != input.npos)
|
||||
{
|
||||
std::string::size_type nameStartPos = pos +
|
||||
@ -779,7 +778,7 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
|
||||
|
||||
if (!errorString.empty())
|
||||
{
|
||||
mf->IssueMessage(cmake::FATAL_ERROR, errorString);
|
||||
target->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, errorString);
|
||||
}
|
||||
}
|
||||
|
||||
@ -860,7 +859,7 @@ cmExportFileGenerator
|
||||
preprocessRule);
|
||||
if (!prepro.empty())
|
||||
{
|
||||
this->ResolveTargetsInGeneratorExpressions(prepro, target->Target,
|
||||
this->ResolveTargetsInGeneratorExpressions(prepro, target,
|
||||
missingTargets,
|
||||
ReplaceFreeTargets);
|
||||
properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro;
|
||||
@ -962,7 +961,7 @@ cmExportFileGenerator
|
||||
sep = ";";
|
||||
|
||||
std::string temp = *li;
|
||||
this->AddTargetNamespace(temp, target->Target, missingTargets);
|
||||
this->AddTargetNamespace(temp, target, missingTargets);
|
||||
link_entries += temp;
|
||||
}
|
||||
|
||||
@ -1044,12 +1043,12 @@ void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os,
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
cmExportFileGenerator
|
||||
::GenerateImportTargetCode(std::ostream& os, cmTarget const* target)
|
||||
::GenerateImportTargetCode(std::ostream& os, const cmGeneratorTarget* target)
|
||||
{
|
||||
// Construct the imported target name.
|
||||
std::string targetName = this->Namespace;
|
||||
|
||||
targetName += target->GetExportName();
|
||||
targetName += target->Target->GetExportName();
|
||||
|
||||
// Create the imported target.
|
||||
os << "# Create imported target " << targetName << "\n";
|
||||
@ -1078,27 +1077,27 @@ cmExportFileGenerator
|
||||
}
|
||||
|
||||
// Mark the imported executable if it has exports.
|
||||
if(target->IsExecutableWithExports())
|
||||
if(target->Target->IsExecutableWithExports())
|
||||
{
|
||||
os << "set_property(TARGET " << targetName
|
||||
<< " PROPERTY ENABLE_EXPORTS 1)\n";
|
||||
}
|
||||
|
||||
// Mark the imported library if it is a framework.
|
||||
if(target->IsFrameworkOnApple())
|
||||
if(target->Target->IsFrameworkOnApple())
|
||||
{
|
||||
os << "set_property(TARGET " << targetName
|
||||
<< " PROPERTY FRAMEWORK 1)\n";
|
||||
}
|
||||
|
||||
// Mark the imported executable if it is an application bundle.
|
||||
if(target->IsAppBundleOnApple())
|
||||
if(target->Target->IsAppBundleOnApple())
|
||||
{
|
||||
os << "set_property(TARGET " << targetName
|
||||
<< " PROPERTY MACOSX_BUNDLE 1)\n";
|
||||
}
|
||||
|
||||
if (target->IsCFBundleOnApple())
|
||||
if (target->Target->IsCFBundleOnApple())
|
||||
{
|
||||
os << "set_property(TARGET " << targetName
|
||||
<< " PROPERTY BUNDLE 1)\n";
|
||||
|
@ -75,7 +75,8 @@ protected:
|
||||
const std::string& config = "");
|
||||
void GenerateImportFooterCode(std::ostream& os);
|
||||
void GenerateImportVersionCode(std::ostream& os);
|
||||
void GenerateImportTargetCode(std::ostream& os, cmTarget const* target);
|
||||
void GenerateImportTargetCode(std::ostream& os,
|
||||
cmGeneratorTarget const* target);
|
||||
void GenerateImportPropertyCode(std::ostream& os, const std::string& config,
|
||||
cmTarget const* target,
|
||||
ImportPropertyMap const& properties);
|
||||
@ -122,19 +123,21 @@ protected:
|
||||
cmTarget* depender,
|
||||
cmTarget* dependee) = 0;
|
||||
void PopulateInterfaceProperty(const std::string&,
|
||||
cmTarget *target,
|
||||
cmGeneratorTarget *target,
|
||||
cmGeneratorExpression::PreprocessContext,
|
||||
ImportPropertyMap &properties,
|
||||
std::vector<std::string> &missingTargets);
|
||||
bool PopulateInterfaceLinkLibrariesProperty(cmTarget *target,
|
||||
bool PopulateInterfaceLinkLibrariesProperty(cmGeneratorTarget* target,
|
||||
cmGeneratorExpression::PreprocessContext,
|
||||
ImportPropertyMap &properties,
|
||||
std::vector<std::string> &missingTargets);
|
||||
void PopulateInterfaceProperty(const std::string& propName, cmTarget *target,
|
||||
void PopulateInterfaceProperty(const std::string& propName,
|
||||
cmGeneratorTarget* target,
|
||||
ImportPropertyMap &properties);
|
||||
void PopulateCompatibleInterfaceProperties(cmGeneratorTarget *target,
|
||||
ImportPropertyMap &properties);
|
||||
void GenerateInterfaceProperties(cmTarget const* target, std::ostream& os,
|
||||
void GenerateInterfaceProperties(cmGeneratorTarget const* target,
|
||||
std::ostream& os,
|
||||
const ImportPropertyMap &properties);
|
||||
void PopulateIncludeDirectoriesInterface(
|
||||
cmTargetExport *target,
|
||||
@ -159,7 +162,7 @@ protected:
|
||||
};
|
||||
|
||||
void ResolveTargetsInGeneratorExpressions(std::string &input,
|
||||
cmTarget* target,
|
||||
cmGeneratorTarget* target,
|
||||
std::vector<std::string> &missingTargets,
|
||||
FreeTargetsReplace replace = NoReplaceFreeTargets);
|
||||
|
||||
@ -182,20 +185,20 @@ protected:
|
||||
bool AppendMode;
|
||||
|
||||
// The set of targets included in the export.
|
||||
std::set<cmTarget*> ExportedTargets;
|
||||
std::set<cmGeneratorTarget*> ExportedTargets;
|
||||
|
||||
private:
|
||||
void PopulateInterfaceProperty(const std::string&, const std::string&,
|
||||
cmTarget *target,
|
||||
cmGeneratorTarget* target,
|
||||
cmGeneratorExpression::PreprocessContext,
|
||||
ImportPropertyMap &properties,
|
||||
std::vector<std::string> &missingTargets);
|
||||
|
||||
bool AddTargetNamespace(std::string &input, cmTarget* target,
|
||||
bool AddTargetNamespace(std::string &input, cmGeneratorTarget* target,
|
||||
std::vector<std::string> &missingTargets);
|
||||
|
||||
void ResolveTargetsInGeneratorExpression(std::string &input,
|
||||
cmTarget* target,
|
||||
cmGeneratorTarget* target,
|
||||
std::vector<std::string> &missingTargets);
|
||||
|
||||
virtual void ReplaceInstallPrefix(std::string &input);
|
||||
|
@ -52,7 +52,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
|
||||
sep + this->Namespace + (*tei)->Target->Target->GetExportName();
|
||||
sep = " ";
|
||||
cmTargetExport * te = *tei;
|
||||
if(this->ExportedTargets.insert(te->Target->Target).second)
|
||||
if(this->ExportedTargets.insert(te->Target).second)
|
||||
{
|
||||
allTargets.push_back(te);
|
||||
}
|
||||
@ -133,12 +133,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
|
||||
tei != allTargets.end(); ++tei)
|
||||
{
|
||||
cmGeneratorTarget* gt = (*tei)->Target;
|
||||
cmTarget* te = gt->Target;
|
||||
|
||||
requiresConfigFiles = requiresConfigFiles
|
||||
|| te->GetType() != cmState::INTERFACE_LIBRARY;
|
||||
|| gt->GetType() != cmState::INTERFACE_LIBRARY;
|
||||
|
||||
this->GenerateImportTargetCode(os, te);
|
||||
this->GenerateImportTargetCode(os, gt);
|
||||
|
||||
ImportPropertyMap properties;
|
||||
|
||||
@ -149,32 +148,32 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
|
||||
cmGeneratorExpression::InstallInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",
|
||||
te,
|
||||
gt,
|
||||
cmGeneratorExpression::InstallInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS",
|
||||
te,
|
||||
gt,
|
||||
cmGeneratorExpression::InstallInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS",
|
||||
te,
|
||||
gt,
|
||||
cmGeneratorExpression::InstallInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS",
|
||||
te,
|
||||
gt,
|
||||
cmGeneratorExpression::InstallInterface,
|
||||
properties, missingTargets);
|
||||
this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES",
|
||||
te,
|
||||
gt,
|
||||
cmGeneratorExpression::InstallInterface,
|
||||
properties, missingTargets);
|
||||
|
||||
const bool newCMP0022Behavior =
|
||||
te->GetPolicyStatusCMP0022() != cmPolicies::WARN
|
||||
&& te->GetPolicyStatusCMP0022() != cmPolicies::OLD;
|
||||
gt->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN
|
||||
&& gt->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
|
||||
if (newCMP0022Behavior)
|
||||
{
|
||||
if (this->PopulateInterfaceLinkLibrariesProperty(te,
|
||||
if (this->PopulateInterfaceLinkLibrariesProperty(gt,
|
||||
cmGeneratorExpression::InstallInterface,
|
||||
properties, missingTargets)
|
||||
&& !this->ExportOld)
|
||||
@ -182,11 +181,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
|
||||
require2_8_12 = true;
|
||||
}
|
||||
}
|
||||
if (te->GetType() == cmState::INTERFACE_LIBRARY)
|
||||
if (gt->GetType() == cmState::INTERFACE_LIBRARY)
|
||||
{
|
||||
require3_0_0 = true;
|
||||
}
|
||||
if(te->GetProperty("INTERFACE_SOURCES"))
|
||||
if(gt->GetProperty("INTERFACE_SOURCES"))
|
||||
{
|
||||
// We can only generate INTERFACE_SOURCES in CMake 3.3, but CMake 3.1
|
||||
// can consume them.
|
||||
@ -194,11 +193,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
|
||||
}
|
||||
|
||||
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
|
||||
te, properties);
|
||||
gt, properties);
|
||||
|
||||
this->PopulateCompatibleInterfaceProperties(gt, properties);
|
||||
|
||||
this->GenerateInterfaceProperties(gt->Target, os, properties);
|
||||
this->GenerateInterfaceProperties(gt, os, properties);
|
||||
}
|
||||
|
||||
if (require3_1_0)
|
||||
|
@ -28,29 +28,29 @@ cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
|
||||
|
||||
bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
|
||||
{
|
||||
std::set<cmTarget const*> emitted;
|
||||
std::set<cmTarget const*> emittedDeps;
|
||||
std::set<cmGeneratorTarget const*> emitted;
|
||||
std::set<cmGeneratorTarget const*> emittedDeps;
|
||||
while(!this->Exports.empty())
|
||||
{
|
||||
cmGeneratorTarget const* te = this->Exports.back();
|
||||
this->Exports.pop_back();
|
||||
if (emitted.insert(te->Target).second)
|
||||
if (emitted.insert(te).second)
|
||||
{
|
||||
emittedDeps.insert(te->Target);
|
||||
this->GenerateImportTargetCode(os, te->Target);
|
||||
emittedDeps.insert(te);
|
||||
this->GenerateImportTargetCode(os, te);
|
||||
|
||||
ImportPropertyMap properties;
|
||||
|
||||
#define FIND_TARGETS(PROPERTY) \
|
||||
this->FindTargets("INTERFACE_" #PROPERTY, te->Target, emittedDeps);
|
||||
this->FindTargets("INTERFACE_" #PROPERTY, te, emittedDeps);
|
||||
|
||||
CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(FIND_TARGETS)
|
||||
|
||||
#undef FIND_TARGETS
|
||||
|
||||
this->PopulateProperties(te->Target, properties, emittedDeps);
|
||||
this->PopulateProperties(te, properties, emittedDeps);
|
||||
|
||||
this->GenerateInterfaceProperties(te->Target, os, properties);
|
||||
this->GenerateInterfaceProperties(te, os, properties);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -58,8 +58,8 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
|
||||
|
||||
std::string cmExportTryCompileFileGenerator::FindTargets(
|
||||
const std::string& propName,
|
||||
cmTarget const* tgt,
|
||||
std::set<cmTarget const*> &emitted)
|
||||
cmGeneratorTarget const* tgt,
|
||||
std::set<cmGeneratorTarget const*> &emitted)
|
||||
{
|
||||
const char *prop = tgt->GetProperty(propName);
|
||||
if(!prop)
|
||||
@ -77,24 +77,22 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
|
||||
|
||||
cmTarget dummyHead;
|
||||
dummyHead.SetType(cmState::EXECUTABLE, "try_compile_dummy_exe");
|
||||
dummyHead.SetMakefile(tgt->GetMakefile());
|
||||
dummyHead.SetMakefile(tgt->Target->GetMakefile());
|
||||
|
||||
cmGeneratorTarget* gtgt =
|
||||
tgt->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(tgt);
|
||||
cmGeneratorTarget gDummyHead(&dummyHead, gtgt->GetLocalGenerator());
|
||||
cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
|
||||
|
||||
std::string result = cge->Evaluate(gtgt->GetLocalGenerator(), this->Config,
|
||||
std::string result = cge->Evaluate(tgt->GetLocalGenerator(), this->Config,
|
||||
false, &gDummyHead,
|
||||
gtgt, &dagChecker);
|
||||
tgt, &dagChecker);
|
||||
|
||||
const std::set<cmGeneratorTarget const*> &allTargets =
|
||||
cge->GetAllTargetsSeen();
|
||||
for(std::set<cmGeneratorTarget const*>::const_iterator li =
|
||||
allTargets.begin(); li != allTargets.end(); ++li)
|
||||
{
|
||||
if(emitted.insert((*li)->Target).second)
|
||||
if(emitted.insert(*li).second)
|
||||
{
|
||||
this->Exports.push_back((*li));
|
||||
this->Exports.push_back(*li);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -102,13 +100,12 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target,
|
||||
cmExportTryCompileFileGenerator::PopulateProperties(
|
||||
const cmGeneratorTarget* target,
|
||||
ImportPropertyMap& properties,
|
||||
std::set<cmTarget const*> &emitted)
|
||||
std::set<cmGeneratorTarget const*> &emitted)
|
||||
{
|
||||
cmPropertyMap props = target->GetProperties();
|
||||
cmGeneratorTarget* gt =
|
||||
target->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(target);
|
||||
cmPropertyMap props = target->Target->GetProperties();
|
||||
for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i)
|
||||
{
|
||||
properties[i->first] = i->second.GetValue();
|
||||
@ -126,8 +123,8 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target,
|
||||
li != depends.end(); ++li)
|
||||
{
|
||||
cmGeneratorTarget *tgt =
|
||||
gt->GetLocalGenerator()->FindGeneratorTargetToUse(*li);
|
||||
if(tgt && emitted.insert(tgt->Target).second)
|
||||
target->GetLocalGenerator()->FindGeneratorTargetToUse(*li);
|
||||
if(tgt && emitted.insert(tgt).second)
|
||||
{
|
||||
this->Exports.push_back(tgt);
|
||||
}
|
||||
|
@ -41,15 +41,16 @@ protected:
|
||||
cmTarget*,
|
||||
cmTarget*) {}
|
||||
|
||||
void PopulateProperties(cmTarget const* target,
|
||||
void PopulateProperties(cmGeneratorTarget const* target,
|
||||
ImportPropertyMap& properties,
|
||||
std::set<cmTarget const*> &emitted);
|
||||
std::set<const cmGeneratorTarget*>& emitted);
|
||||
|
||||
std::string InstallNameDir(cmGeneratorTarget* target,
|
||||
const std::string& config);
|
||||
private:
|
||||
std::string FindTargets(const std::string& prop, cmTarget const* tgt,
|
||||
std::set<cmTarget const*> &emitted);
|
||||
std::string FindTargets(const std::string& prop,
|
||||
const cmGeneratorTarget* tgt,
|
||||
std::set<const cmGeneratorTarget*>& emitted);
|
||||
|
||||
|
||||
std::vector<cmGeneratorTarget const*> Exports;
|
||||
|
Loading…
Reference in New Issue
Block a user