Commit 9afbb733 authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'use-generator-target'

d8f8940b cmGeneratorTarget: Move IsCFBundleOnApple from cmTarget.
7550879f cmGeneratorTarget: Move IsXCTestOnApple from cmTarget.
88d10d55 cmGeneratorTarget: Copy IsAppBundleOnApple from cmTarget.
b5f5de70 cmGeneratorTarget: Copy IsFrameworkOnApple from cmTarget.
8e20ea6e cmGeneratorTarget: Move IsLinkable from cmTarget.
a527abf0 Xcode: Port internal API to cmGeneratorTarget.
eb3be7d6 cmGeneratorTarget: Move GetExportName from cmTarget.
d231c31b Export: Port internal API to cmGeneratorTarget.
e6661282 Export: Port internal utility to cmGeneratorTarget.
2b9cc1e2 Export: Port some API to cmGlobalGenerator.
97062ac2 cmInstallTargetGenerator: Port GetInstallFilename to cmGeneratorTarget.
6a72b3c8 Export: Port interface to cmGeneratorTarget.
1293c156 cmExportTryCompileFileGenerator: Port to cmGeneratorTarget.
381e7afd cmExportSet: Store a cmGeneratorTarget.
65911cae cmGlobalGenerator: Compute export() related classes early.
37ab74a6 cmLocalGenerator: Port PList handling to cmGeneratorTarget.
...
parents 5ec8064b d8f8940b
......@@ -109,7 +109,7 @@ std::string cmCommonTargetGenerator::ComputeFortranModuleDirectory() const
{
std::string mod_dir;
const char* target_mod_dir =
this->Target->GetProperty("Fortran_MODULE_DIRECTORY");
this->GeneratorTarget->GetProperty("Fortran_MODULE_DIRECTORY");
const char* moddir_flag =
this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
if(target_mod_dir && moddir_flag)
......@@ -214,7 +214,7 @@ cmCommonTargetGenerator
this->LocalGenerator->GetFortranFormat(srcfmt);
if(format == cmLocalGenerator::FortranFormatNone)
{
const char* tgtfmt = this->Target->GetProperty("Fortran_FORMAT");
const char* tgtfmt = this->GeneratorTarget->GetProperty("Fortran_FORMAT");
format = this->LocalGenerator->GetFortranFormat(tgtfmt);
}
const char* var = 0;
......@@ -316,10 +316,11 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string &l)
this->AddFortranFlags(flags);
}
this->LocalGenerator->AddCMP0018Flags(flags, this->Target,
this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget,
lang, this->ConfigName);
this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target,
this->LocalGenerator->AddVisibilityPresetFlags(flags,
this->GeneratorTarget,
lang);
// Append old-style preprocessor definition flags.
......@@ -331,7 +332,7 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string &l)
AppendFlags(flags,this->GetFrameworkFlags(l));
// Add target-specific flags.
this->LocalGenerator->AddCompileOptions(flags, this->Target,
this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget,
lang, this->ConfigName);
ByLanguageMap::value_type entry(l, flags);
......@@ -354,7 +355,7 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string &l)
}
// Add preprocessor definitions for this target and configuration.
this->LocalGenerator->AddCompileDefinitions(defines, this->Target,
this->LocalGenerator->AddCompileDefinitions(defines, this->GeneratorTarget,
this->LocalGenerator->GetConfigName(), l);
std::string definesString;
......@@ -400,8 +401,7 @@ cmCommonTargetGenerator::GetLinkedTargetDirectories() const
&& emitted.insert(linkee).second)
{
cmLocalGenerator* lg = linkee->GetLocalGenerator();
cmMakefile* mf = linkee->Target->GetMakefile();
std::string di = mf->GetCurrentBinaryDirectory();
std::string di = lg->GetCurrentBinaryDirectory();
di += "/";
di += lg->GetTargetDirectory(linkee);
dirs.push_back(di);
......
......@@ -643,7 +643,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
return;
}
if(tgt && tgt->Target->IsLinkable())
if(tgt && tgt->IsLinkable())
{
// This is a CMake target. Ask the target for its real name.
if(impexe && this->LoaderFlag)
......@@ -1111,7 +1111,7 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
// For compatibility with CMake 2.4 include the item's directory in
// the linker search path.
if(this->OldLinkDirMode && !target->Target->IsFrameworkOnApple() &&
if(this->OldLinkDirMode && !target->IsFrameworkOnApple() &&
this->OldLinkDirMask.find(cmSystemTools::GetFilenamePath(item)) ==
this->OldLinkDirMask.end())
{
......
......@@ -417,7 +417,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
const cmGeneratorTarget* dependee,
bool linking)
{
if(dependee->Target->IsImported() ||
if(dependee->IsImported() ||
dependee->GetType() == cmState::INTERFACE_LIBRARY)
{
// Skip IMPORTED and INTERFACE targets but follow their utility
......
......@@ -34,7 +34,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
std::string outputVariable;
std::string copyFile;
std::string copyFileError;
std::vector<cmTarget const*> targets;
std::vector<std::string> targets;
std::string libsToLink = " ";
bool useOldLinkLibs = true;
char targetNameBuf[64];
......@@ -112,7 +112,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
if (tgt->IsImported())
{
targets.push_back(tgt);
targets.push_back(argv[i]);
}
}
}
......@@ -375,9 +375,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if (!targets.empty())
{
std::string fname = "/" + std::string(targetName) + "Targets.cmake";
cmExportTryCompileFileGenerator tcfg(gg);
cmExportTryCompileFileGenerator tcfg(gg, targets, this->Makefile);
tcfg.SetExportFile((this->BinaryDirectory + fname).c_str());
tcfg.SetExports(targets);
tcfg.SetConfig(this->Makefile->GetSafeDefinition(
"CMAKE_TRY_COMPILE_CONFIGURATION"));
......
......@@ -45,7 +45,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
cmGeneratorTarget* target =
this->LG->FindGeneratorTargetToUse(argv0);
if(target && target->GetType() == cmState::EXECUTABLE &&
(target->Target->IsImported()
(target->IsImported()
|| !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING")))
{
return target->GetLocation(this->Config);
......
......@@ -27,6 +27,10 @@ cmExportBuildFileGenerator::cmExportBuildFileGenerator()
void cmExportBuildFileGenerator::Compute(cmLocalGenerator* lg)
{
this->LG = lg;
if (this->ExportSet)
{
this->ExportSet->Compute(lg);
}
}
//----------------------------------------------------------------------------
......@@ -44,9 +48,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
{
cmGeneratorTarget *te = this->LG
->FindGeneratorTargetToUse(*tei);
expectedTargets += sep + this->Namespace + te->Target->GetExportName();
expectedTargets += sep + this->Namespace + te->GetExportName();
sep = " ";
if(this->ExportedTargets.insert(te->Target).second)
if(this->ExportedTargets.insert(te).second)
{
this->Exports.push_back(te);
}
......@@ -76,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.
......@@ -171,7 +174,7 @@ cmExportBuildFileGenerator
// properties);
// Generate code in the export file.
this->GenerateImportPropertyCode(os, config, target->Target,
this->GenerateImportPropertyCode(os, config, target,
properties);
}
}
......@@ -199,7 +202,7 @@ cmExportBuildFileGenerator
std::string prop = "IMPORTED_LOCATION";
prop += suffix;
std::string value;
if(target->Target->IsAppBundleOnApple())
if(target->IsAppBundleOnApple())
{
value = target->GetFullPath(config, false);
}
......@@ -232,14 +235,18 @@ cmExportBuildFileGenerator
//----------------------------------------------------------------------------
void
cmExportBuildFileGenerator::HandleMissingTarget(
std::string& link_libs, std::vector<std::string>& missingTargets,
cmMakefile* mf, cmTarget* depender, cmTarget* dependee)
std::string& link_libs,
std::vector<std::string>& missingTargets,
cmGeneratorTarget* depender,
cmGeneratorTarget* dependee)
{
// The target is not in the export.
if(!this->AppendMode)
{
const std::string name = dependee->GetName();
std::vector<std::string> namespaces = this->FindNamespaces(mf, name);
cmGlobalGenerator* gg =
dependee->GetLocalGenerator()->GetGlobalGenerator();
std::vector<std::string> namespaces = this->FindNamespaces(gg, name);
int targetOccurrences = (int)namespaces.size();
if (targetOccurrences == 1)
......@@ -274,7 +281,7 @@ void cmExportBuildFileGenerator
tei = this->ExportSet->GetTargetExports()->begin();
tei != this->ExportSet->GetTargetExports()->end(); ++tei)
{
targets.push_back((*tei)->Target->GetName());
targets.push_back((*tei)->TargetName);
}
return;
}
......@@ -284,10 +291,9 @@ void cmExportBuildFileGenerator
//----------------------------------------------------------------------------
std::vector<std::string>
cmExportBuildFileGenerator
::FindNamespaces(cmMakefile* mf, const std::string& name)
::FindNamespaces(cmGlobalGenerator* gg, const std::string& name)
{
std::vector<std::string> namespaces;
cmGlobalGenerator* gg = mf->GetGlobalGenerator();
std::map<std::string, cmExportBuildFileGenerator*>& exportSets
= gg->GetBuildExportSets();
......@@ -310,8 +316,8 @@ cmExportBuildFileGenerator
//----------------------------------------------------------------------------
void
cmExportBuildFileGenerator
::ComplainAboutMissingTarget(cmTarget* depender,
cmTarget* dependee,
::ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
int occurrences)
{
if(cmSystemTools::GetErrorOccuredFlag())
......
......@@ -54,12 +54,11 @@ protected:
std::vector<std::string> &missingTargets);
virtual void HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets,
cmMakefile* mf,
cmTarget* depender,
cmTarget* dependee);
cmGeneratorTarget* depender,
cmGeneratorTarget* dependee);
void ComplainAboutMissingTarget(cmTarget* depender,
cmTarget* dependee,
void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
int occurrences);
/** Fill in properties indicating built file locations. */
......@@ -72,7 +71,7 @@ protected:
const std::string& config);
std::vector<std::string>
FindNamespaces(cmMakefile* mf, const std::string& name);
FindNamespaces(cmGlobalGenerator* gg, const std::string& name);
std::vector<std::string> Targets;
cmExportSet *ExportSet;
......
This diff is collapsed.
......@@ -75,11 +75,13 @@ 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,
cmGeneratorTarget const* target,
ImportPropertyMap const& properties);
void GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target,
void GenerateImportedFileChecksCode(std::ostream& os,
cmGeneratorTarget* target,
ImportPropertyMap const& properties,
const std::set<std::string>& importedLocations);
void GenerateImportedFileCheckLoop(std::ostream& os);
......@@ -118,23 +120,24 @@ protected:
* export set. */
virtual void HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets,
cmMakefile* mf,
cmTarget* depender,
cmTarget* dependee) = 0;
cmGeneratorTarget* depender,
cmGeneratorTarget* 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);
......
......@@ -48,7 +48,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
tei = this->IEGen->GetExportSet()->GetTargetExports()->begin();
tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei)
{
expectedTargets += sep + this->Namespace + (*tei)->Target->GetExportName();
expectedTargets +=
sep + this->Namespace + (*tei)->Target->GetExportName();
sep = " ";
cmTargetExport * te = *tei;
if(this->ExportedTargets.insert(te->Target).second)
......@@ -131,12 +132,12 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
tei = allTargets.begin();
tei != allTargets.end(); ++tei)
{
cmTarget* te = (*tei)->Target;
cmGeneratorTarget* gt = (*tei)->Target;
requiresConfigFiles = requiresConfigFiles
|| te->GetType() != cmState::INTERFACE_LIBRARY;
|| gt->GetType() != cmState::INTERFACE_LIBRARY;
this->GenerateImportTargetCode(os, te);
this->GenerateImportTargetCode(os, gt);
ImportPropertyMap properties;
......@@ -147,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)
......@@ -180,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.
......@@ -192,14 +193,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
}
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties);
cmGeneratorTarget *gtgt = te->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(te);
gt, properties);
this->PopulateCompatibleInterfaceProperties(gtgt, properties);
this->PopulateCompatibleInterfaceProperties(gt, properties);
this->GenerateInterfaceProperties(te, os, properties);
this->GenerateInterfaceProperties(gt, os, properties);
}
if (require3_1_0)
......@@ -362,8 +360,7 @@ cmExportInstallFileGenerator
if(!properties.empty())
{
// Get the rest of the target details.
cmGeneratorTarget *gtgt = te->Target->GetMakefile()
->GetGlobalGenerator()->GetGeneratorTarget(te->Target);
cmGeneratorTarget *gtgt = te->Target;
this->SetImportDetailProperties(config, suffix,
gtgt, properties, missingTargets);
......@@ -378,8 +375,8 @@ cmExportInstallFileGenerator
// properties);
// Generate code in the export file.
this->GenerateImportPropertyCode(os, config, te->Target, properties);
this->GenerateImportedFileChecksCode(os, te->Target, properties,
this->GenerateImportPropertyCode(os, config, gtgt, properties);
this->GenerateImportedFileChecksCode(os, gtgt, properties,
importedLocations);
}
}
......@@ -402,7 +399,7 @@ cmExportInstallFileGenerator
}
// Get the target to be installed.
cmTarget* target = itgen->GetTarget()->Target;
cmGeneratorTarget* target = itgen->GetTarget();
// Construct the installed location of the target.
std::string dest = itgen->GetDestination(config);
......@@ -456,12 +453,13 @@ cmExportInstallFileGenerator
//----------------------------------------------------------------------------
void
cmExportInstallFileGenerator::HandleMissingTarget(
std::string& link_libs, std::vector<std::string>& missingTargets,
cmMakefile* mf, cmTarget* depender, cmTarget* dependee)
cmExportInstallFileGenerator::HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets,
cmGeneratorTarget* depender, cmGeneratorTarget* dependee)
{
const std::string name = dependee->GetName();
std::vector<std::string> namespaces = this->FindNamespaces(mf, name);
cmGlobalGenerator* gg = dependee->GetLocalGenerator()->GetGlobalGenerator();
std::vector<std::string> namespaces = this->FindNamespaces(gg, name);
int targetOccurrences = (int)namespaces.size();
if (targetOccurrences == 1)
{
......@@ -482,10 +480,9 @@ cmExportInstallFileGenerator::HandleMissingTarget(
//----------------------------------------------------------------------------
std::vector<std::string>
cmExportInstallFileGenerator
::FindNamespaces(cmMakefile* mf, const std::string& name)
::FindNamespaces(cmGlobalGenerator* gg, const std::string& name)
{
std::vector<std::string> namespaces;
cmGlobalGenerator* gg = mf->GetGlobalGenerator();
const cmExportSetMap& exportSets = gg->GetExportSets();
for(cmExportSetMap::const_iterator expIt = exportSets.begin();
......@@ -523,8 +520,8 @@ cmExportInstallFileGenerator
//----------------------------------------------------------------------------
void
cmExportInstallFileGenerator
::ComplainAboutMissingTarget(cmTarget* depender,
cmTarget* dependee,
::ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
int occurrences)
{
std::ostringstream e;
......
......@@ -57,17 +57,16 @@ protected:
std::vector<std::string> &missingTargets);
virtual void HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets,
cmMakefile* mf,
cmTarget* depender,
cmTarget* dependee);
cmGeneratorTarget* depender,
cmGeneratorTarget* dependee);
virtual void ReplaceInstallPrefix(std::string &input);
void ComplainAboutMissingTarget(cmTarget* depender,
cmTarget* dependee,
void ComplainAboutMissingTarget(cmGeneratorTarget* depender,
cmGeneratorTarget* dependee,
int occurrences);
std::vector<std::string> FindNamespaces(cmMakefile* mf,
std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg,
const std::string& name);
......
......@@ -13,12 +13,22 @@
#include "cmExportSet.h"
#include "cmTargetExport.h"
#include "cmAlgorithms.h"
#include "cmLocalGenerator.h"
cmExportSet::~cmExportSet()
{
cmDeleteAll(this->TargetExports);
}
void cmExportSet::Compute(cmLocalGenerator* lg)
{
for (std::vector<cmTargetExport*>::iterator it = this->TargetExports.begin();
it != this->TargetExports.end(); ++it)
{
(*it)->Target = lg->FindGeneratorTargetToUse((*it)->TargetName);
}
}
void cmExportSet::AddTargetExport(cmTargetExport* te)
{
this->TargetExports.push_back(te);
......
......@@ -15,6 +15,7 @@
#include "cmSystemTools.h"
class cmTargetExport;
class cmInstallExportGenerator;
class cmLocalGenerator;
/// A set of targets that were installed with the same EXPORT parameter.
class cmExportSet
......@@ -25,6 +26,8 @@ public:
/// Destructor
~cmExportSet();
void Compute(cmLocalGenerator* lg);
void AddTargetExport(cmTargetExport* tgt);
void AddInstallation(cmInstallExportGenerator const* installation);
......
......@@ -14,22 +14,25 @@
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmGeneratorExpressionDAGChecker.h"
//----------------------------------------------------------------------------
cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
cmGlobalGenerator* gg)
cmGlobalGenerator* gg,
const std::vector<std::string>& targets,
cmMakefile* mf)
{
gg->CreateGenerationObjects(cmGlobalGenerator::ImportedOnly);
gg->CreateImportedGenerationObjects(mf, targets, this->Exports);
}
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())
{
cmTarget const* te = this->Exports.back();
cmGeneratorTarget const* te = this->Exports.back();
this->Exports.pop_back();
if (emitted.insert(te).second)
{
......@@ -54,9 +57,9 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
}
std::string cmExportTryCompileFileGenerator::FindTargets(
const std::string& propName,
cmTarget const* tgt,
std::set<cmTarget const*> &emitted)
const std::string& propName,
cmGeneratorTarget const* tgt,
std::set<cmGeneratorTarget const*> &emitted)
{
const char *prop = tgt->GetProperty(propName);
if(!prop)
......@@ -74,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