cmExportTryCompileFileGenerator: Create cmGeneratorTargets.
This is not a deprecated behavior, but only requires IMPORTED targets be made.
This commit is contained in:
parent
ec38e4c84f
commit
570938cbfd
|
@ -379,7 +379,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
|
|||
if (!targets.empty())
|
||||
{
|
||||
std::string fname = "/" + std::string(targetName) + "Targets.cmake";
|
||||
cmExportTryCompileFileGenerator tcfg;
|
||||
cmExportTryCompileFileGenerator tcfg(gg);
|
||||
tcfg.SetExportFile((this->BinaryDirectory + fname).c_str());
|
||||
tcfg.SetExports(targets);
|
||||
tcfg.SetConfig(this->Makefile->GetSafeDefinition(
|
||||
|
|
|
@ -13,9 +13,16 @@
|
|||
#include "cmExportTryCompileFileGenerator.h"
|
||||
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmGeneratorExpressionDAGChecker.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
|
||||
cmGlobalGenerator* gg)
|
||||
{
|
||||
gg->CreateGenerationObjects(cmGlobalGenerator::ImportedOnly);
|
||||
}
|
||||
|
||||
bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
|
||||
{
|
||||
std::set<cmTarget const*> emitted;
|
||||
|
|
|
@ -20,6 +20,8 @@ class cmInstallTargetGenerator;
|
|||
class cmExportTryCompileFileGenerator: public cmExportFileGenerator
|
||||
{
|
||||
public:
|
||||
cmExportTryCompileFileGenerator(cmGlobalGenerator* gg);
|
||||
|
||||
/** Set the list of targets to export. */
|
||||
void SetExports(const std::vector<cmTarget const*> &exports)
|
||||
{ this->Exports = exports; }
|
||||
|
|
|
@ -1170,11 +1170,11 @@ void cmGlobalGenerator::Configure()
|
|||
|
||||
}
|
||||
|
||||
void cmGlobalGenerator::CreateGenerationObjects()
|
||||
void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes)
|
||||
{
|
||||
cmDeleteAll(this->GeneratorTargets);
|
||||
this->GeneratorTargets.clear();
|
||||
this->CreateGeneratorTargets();
|
||||
this->CreateGeneratorTargets(targetTypes);
|
||||
}
|
||||
|
||||
cmExportBuildFileGenerator*
|
||||
|
@ -1485,18 +1485,22 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalGenerator::CreateGeneratorTargets(cmLocalGenerator *lg)
|
||||
void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
|
||||
cmLocalGenerator *lg)
|
||||
{
|
||||
cmGeneratorTargetsType generatorTargets;
|
||||
cmMakefile* mf = lg->GetMakefile();
|
||||
cmTargets& targets = mf->GetTargets();
|
||||
for(cmTargets::iterator ti = targets.begin();
|
||||
ti != targets.end(); ++ti)
|
||||
if (targetTypes == AllTargets)
|
||||
{
|
||||
cmTarget* t = &ti->second;
|
||||
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
|
||||
this->GeneratorTargets[t] = gt;
|
||||
generatorTargets[t] = gt;
|
||||
cmTargets& targets = mf->GetTargets();
|
||||
for(cmTargets::iterator ti = targets.begin();
|
||||
ti != targets.end(); ++ti)
|
||||
{
|
||||
cmTarget* t = &ti->second;
|
||||
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
|
||||
this->GeneratorTargets[t] = gt;
|
||||
generatorTargets[t] = gt;
|
||||
}
|
||||
}
|
||||
|
||||
for(std::vector<cmTarget*>::const_iterator
|
||||
|
@ -1524,12 +1528,12 @@ void cmGlobalGenerator::InitGeneratorTargets()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalGenerator::CreateGeneratorTargets()
|
||||
void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes)
|
||||
{
|
||||
// Construct per-target generator information.
|
||||
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
|
||||
{
|
||||
this->CreateGeneratorTargets(this->LocalGenerators[i]);
|
||||
this->CreateGeneratorTargets(targetTypes, this->LocalGenerators[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,13 @@ public:
|
|||
*/
|
||||
virtual void Configure();
|
||||
|
||||
void CreateGenerationObjects();
|
||||
|
||||
enum TargetTypes {
|
||||
AllTargets,
|
||||
ImportedOnly
|
||||
};
|
||||
|
||||
void CreateGenerationObjects(TargetTypes targetTypes = AllTargets);
|
||||
|
||||
/**
|
||||
* Generate the all required files for building this project/tree. This
|
||||
|
@ -491,9 +497,9 @@ private:
|
|||
// Per-target generator information.
|
||||
cmGeneratorTargetsType GeneratorTargets;
|
||||
friend class cmake;
|
||||
void CreateGeneratorTargets(cmLocalGenerator* lg);
|
||||
void CreateGeneratorTargets(TargetTypes targetTypes, cmLocalGenerator* lg);
|
||||
void InitGeneratorTargets();
|
||||
void CreateGeneratorTargets();
|
||||
void CreateGeneratorTargets(TargetTypes targetTypes);
|
||||
|
||||
void ClearGeneratorMembers();
|
||||
|
||||
|
|
|
@ -483,7 +483,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
|
|||
std::string linkPath;
|
||||
std::string flags;
|
||||
std::string linkFlags;
|
||||
gg->CreateGeneratorTargets(lg.get());
|
||||
gg->CreateGeneratorTargets(cmGlobalGenerator::AllTargets, lg.get());
|
||||
cmGeneratorTarget *gtgt = gg->GetGeneratorTarget(tgt);
|
||||
lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags,
|
||||
gtgt, false);
|
||||
|
|
Loading…
Reference in New Issue