summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-03-12 21:09:20 +0100
committerStephen Kelly <steveire@gmail.com>2014-03-13 15:27:23 +0100
commitcd43433de56ab31269a076fb2b2ace8babaa107d (patch)
tree3cfc978af258b7b0fc0b046b3d99be1b4cd01254 /Source
parentd5b2e33be2119ad12744ed62920a8f8d9b6d705d (diff)
downloadcmake-cd43433de56ab31269a076fb2b2ace8babaa107d.tar.gz
cmGlobalGenerator: Extract a ComputeTargetObjectDirectory interface.
Make it public for future external calls.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx6
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx27
-rw-r--r--Source/cmGlobalNinjaGenerator.h2
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx27
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h1
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx7
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h1
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
-rw-r--r--Source/cmGlobalXCodeGenerator.h1
10 files changed, 56 insertions, 23 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index b95ff81aec..c9ae799376 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -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;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 91e71a82df..ed07b10cc2 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -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
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 0a05f5a3ef..686414d3fc 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -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,12 +643,27 @@ 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
void cmGlobalNinjaGenerator::OpenBuildFileStream()
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 7725cf3526..e3a22e57c8 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -299,7 +299,7 @@ public:
void AddTargetAlias(const std::string& alias, cmTarget* target);
-
+ virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
protected:
/// Overloaded methods.
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 0e03e8932a..f9ec0a9a64 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -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.
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 811517627a..42453f2812 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -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();
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 69c893cc84..f3cba5a68c 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -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;
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 7e8dcf8b7b..f957056b21 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -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
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 36196a23a0..6c12040c99 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -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);
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index be81cdc4cb..f9dd58f975 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -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"; }