cmGlobalGenerator: Extract a ComputeTargetObjectDirectory interface.
Make it public for future external calls.
This commit is contained in:
parent
d5b2e33be2
commit
cd43433de5
|
@ -1449,6 +1449,7 @@ void cmGlobalGenerator::ComputeGeneratorTargetObjects()
|
|||
continue;
|
||||
}
|
||||
cmGeneratorTarget* gt = ti->second;
|
||||
this->ComputeTargetObjectDirectory(gt);
|
||||
gt->LookupObjectLibraries();
|
||||
this->ComputeTargetObjects(gt);
|
||||
}
|
||||
|
@ -1520,6 +1521,11 @@ void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const
|
|||
// Implemented in generator subclasses that need this.
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
|
||||
{
|
||||
}
|
||||
|
||||
void cmGlobalGenerator::CheckLocalGenerators()
|
||||
{
|
||||
std::map<std::string, std::string> notFoundMap;
|
||||
|
|
|
@ -323,6 +323,8 @@ public:
|
|||
GetExportedTargetsFile(const std::string &filename) const;
|
||||
void AddCMP0042WarnTarget(const std::string& target);
|
||||
|
||||
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
||||
|
||||
protected:
|
||||
typedef std::vector<cmLocalGenerator*> GeneratorVector;
|
||||
// for a project collect all its targets by following depend
|
||||
|
|
|
@ -634,16 +634,6 @@ std::string cmGlobalNinjaGenerator::GetEditCacheCommand() const
|
|||
// TODO: Refactor to combine with cmGlobalUnixMakefileGenerator3 impl.
|
||||
void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
|
||||
{
|
||||
cmTarget* target = gt->Target;
|
||||
|
||||
// Compute full path to object file directory for this target.
|
||||
std::string dir_max;
|
||||
dir_max += gt->Makefile->GetCurrentOutputDirectory();
|
||||
dir_max += "/";
|
||||
dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
|
||||
dir_max += "/";
|
||||
gt->ObjectDirectory = dir_max;
|
||||
|
||||
std::vector<cmSourceFile*> objectSources;
|
||||
gt->GetObjectSources(objectSources);
|
||||
// Compute the name of each object file.
|
||||
|
@ -653,11 +643,26 @@ void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
|
|||
{
|
||||
cmSourceFile* sf = *si;
|
||||
std::string objectName = gt->LocalGenerator
|
||||
->GetObjectFileNameWithoutTarget(*sf, dir_max);
|
||||
->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory);
|
||||
gt->AddObject(sf, objectName);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalNinjaGenerator
|
||||
::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
|
||||
{
|
||||
cmTarget* target = gt->Target;
|
||||
|
||||
// Compute full path to object file directory for this target.
|
||||
std::string dir_max;
|
||||
dir_max += gt->Makefile->GetCurrentOutputDirectory();
|
||||
dir_max += "/";
|
||||
dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
|
||||
dir_max += "/";
|
||||
gt->ObjectDirectory = dir_max;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ public:
|
|||
|
||||
void AddTargetAlias(const std::string& alias, cmTarget* target);
|
||||
|
||||
|
||||
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
||||
protected:
|
||||
|
||||
/// Overloaded methods.
|
||||
|
|
|
@ -108,15 +108,6 @@ void
|
|||
cmGlobalUnixMakefileGenerator3
|
||||
::ComputeTargetObjects(cmGeneratorTarget* gt) const
|
||||
{
|
||||
cmTarget* target = gt->Target;
|
||||
// Compute full path to object file directory for this target.
|
||||
std::string dir_max;
|
||||
dir_max += gt->Makefile->GetCurrentOutputDirectory();
|
||||
dir_max += "/";
|
||||
dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
|
||||
dir_max += "/";
|
||||
gt->ObjectDirectory = dir_max;
|
||||
|
||||
std::vector<cmSourceFile*> objectSources;
|
||||
gt->GetObjectSources(objectSources);
|
||||
// Compute the name of each object file.
|
||||
|
@ -126,11 +117,27 @@ cmGlobalUnixMakefileGenerator3
|
|||
{
|
||||
cmSourceFile* sf = *si;
|
||||
std::string objectName = gt->LocalGenerator
|
||||
->GetObjectFileNameWithoutTarget(*sf, dir_max);
|
||||
->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory);
|
||||
gt->AddObject(sf, objectName);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
cmGlobalUnixMakefileGenerator3
|
||||
::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
|
||||
{
|
||||
cmTarget* target = gt->Target;
|
||||
|
||||
// Compute full path to object file directory for this target.
|
||||
std::string dir_max;
|
||||
dir_max += gt->Makefile->GetCurrentOutputDirectory();
|
||||
dir_max += "/";
|
||||
dir_max += gt->LocalGenerator->GetTargetDirectory(*target);
|
||||
dir_max += "/";
|
||||
gt->ObjectDirectory = dir_max;
|
||||
}
|
||||
|
||||
void cmGlobalUnixMakefileGenerator3::Configure()
|
||||
{
|
||||
// Initialize CMAKE_EDIT_COMMAND cache entry.
|
||||
|
|
|
@ -128,6 +128,7 @@ public:
|
|||
/** Does the make tool tolerate .NOTPARALLEL? */
|
||||
virtual bool AllowNotParallel() const { return true; }
|
||||
|
||||
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
||||
protected:
|
||||
void WriteMainMakefile2();
|
||||
void WriteMainCMakefile();
|
||||
|
|
|
@ -159,10 +159,15 @@ cmGlobalVisualStudioGenerator
|
|||
}
|
||||
gt->AddObject(sf, objectName);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalVisualStudioGenerator
|
||||
::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
|
||||
{
|
||||
std::string dir = gt->Makefile->GetCurrentOutputDirectory();
|
||||
dir += "/";
|
||||
std::string tgtDir = lg->GetTargetDirectory(*gt->Target);
|
||||
std::string tgtDir = gt->LocalGenerator->GetTargetDirectory(*gt->Target);
|
||||
if(!tgtDir.empty())
|
||||
{
|
||||
dir += tgtDir;
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
virtual std::string ExpandCFGIntDir(const std::string& str,
|
||||
const std::string& config) const;
|
||||
|
||||
void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
||||
protected:
|
||||
// Does this VS version link targets to each other if there are
|
||||
// dependencies in the SLN file? This was done for VS versions
|
||||
|
|
|
@ -3964,7 +3964,12 @@ cmGlobalXCodeGenerator
|
|||
|
||||
gt->AddObject(sf, objectName);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalXCodeGenerator
|
||||
::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const
|
||||
{
|
||||
const char* configName = this->GetCMakeCFGIntDir();
|
||||
std::string dir = this->GetObjectsNormalDirectory(
|
||||
"$(PROJECT_NAME)", configName, gt->Target);
|
||||
|
|
|
@ -204,6 +204,7 @@ private:
|
|||
std::vector<std::string> const& defines,
|
||||
bool dflag = false);
|
||||
|
||||
void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
|
||||
protected:
|
||||
virtual const char* GetInstallTargetName() const { return "install"; }
|
||||
virtual const char* GetPackageTargetName() const { return "package"; }
|
||||
|
|
Loading…
Reference in New Issue