summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorExpressionNode.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx32
-rw-r--r--Source/cmGeneratorTarget.h7
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx4
-rw-r--r--Source/cmInstallTargetGenerator.cxx2
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx24
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx14
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx6
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx8
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx8
-rw-r--r--Source/cmNinjaTargetGenerator.cxx2
-rw-r--r--Source/cmTarget.cxx19
-rw-r--r--Source/cmTarget.h7
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx5
15 files changed, 76 insertions, 68 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index b61e26f..961705f 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1586,7 +1586,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
"SHARED libraries.");
return std::string();
}
- std::string result = target->Target->GetDirectory(context->Config);
+ std::string result = target->GetDirectory(context->Config);
result += "/";
result += target->GetSOName(context->Config);
return result;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 278194e..b8a87a2 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -748,7 +748,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const
}
// Now handle the deprecated build-time configuration location.
- location = this->Target->GetDirectory();
+ location = this->GetDirectory();
const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR");
if(cfgid && strcmp(cfgid, ".") != 0)
{
@@ -1434,7 +1434,7 @@ cmGeneratorTarget::GetInstallNameDirForBuildTree(
}
else
{
- dir = this->Target->GetDirectory(config);
+ dir = this->GetDirectory(config);
}
dir += "/";
return dir;
@@ -1735,7 +1735,7 @@ cmGeneratorTarget::GetMacContentDirectory(const std::string& config,
bool implib) const
{
// Start with the output directory for the target.
- std::string fpath = this->Target->GetDirectory(config, implib);
+ std::string fpath = this->GetDirectory(config, implib);
fpath += "/";
bool contentOnly = true;
if(this->Target->IsFrameworkOnApple())
@@ -2860,7 +2860,7 @@ void cmGeneratorTarget::ComputeTargetManifest(
}
// Get the directory.
- std::string dir = this->Target->GetDirectory(config, false);
+ std::string dir = this->GetDirectory(config, false);
// Add each name.
std::string f;
@@ -2894,7 +2894,7 @@ void cmGeneratorTarget::ComputeTargetManifest(
}
if(!impName.empty())
{
- f = this->Target->GetDirectory(config, true);
+ f = this->GetDirectory(config, true);
f += "/";
f += impName;
gg->AddToManifest(f);
@@ -2919,7 +2919,7 @@ std::string cmGeneratorTarget::NormalGetFullPath(const std::string& config,
bool implib,
bool realname) const
{
- std::string fpath = this->Target->GetDirectory(config, implib);
+ std::string fpath = this->GetDirectory(config, implib);
fpath += "/";
if(this->Target->IsAppBundleOnApple())
{
@@ -4454,6 +4454,26 @@ cmGeneratorTarget::GetLinkInterfaceLibraries(const std::string& config,
}
//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetDirectory(const std::string& config,
+ bool implib) const
+{
+ if (this->Target->IsImported())
+ {
+ // Return the directory from which the target is imported.
+ return
+ cmSystemTools::GetFilenamePath(
+ this->Target->ImportedGetFullPath(config, implib));
+ }
+ else if(cmTarget::OutputInfo const* info =
+ this->Target->GetOutputInfo(config))
+ {
+ // Return the directory in which the target will be built.
+ return implib? info->ImpDir : info->OutDir;
+ }
+ return "";
+}
+
+//----------------------------------------------------------------------------
void
cmGeneratorTarget::ComputeLinkInterfaceLibraries(
const std::string& config,
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index f5805f1..43b7922 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -268,6 +268,13 @@ public:
*/
void TraceDependencies();
+ /** Get the directory in which this target will be built. If the
+ configuration name is given then the generator will add its
+ subdirectory for that configuration. Otherwise just the canonical
+ output directory is given. */
+ std::string GetDirectory(const std::string& config = "",
+ bool implib = false) const;
+
/** Get the directory in which to place the target compiler .pdb file.
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 3d52e3a..4144020 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1977,7 +1977,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
if(!target.UsesDefaultOutputDir(configName, false))
{
- std::string pncdir = target.GetDirectory(configName);
+ std::string pncdir = gtgt->GetDirectory(configName);
buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
this->CreateString(pncdir.c_str()));
}
@@ -1986,7 +1986,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
buildSettings->AddAttribute("OBJROOT",
this->CreateString(pndir.c_str()));
- pndir = target.GetDirectory(configName);
+ pndir = gtgt->GetDirectory(configName);
}
if(target.IsFrameworkOnApple() || target.IsCFBundleOnApple())
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 30cf175..383ee00 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -83,7 +83,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
else
{
fromDirConfig =
- this->Target->Target->GetDirectory(config, this->ImportLibrary);
+ this->Target->GetDirectory(config, this->ImportLibrary);
fromDirConfig += "/";
}
std::string toDir =
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index ab215d1..862ab2d 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -805,7 +805,11 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target,
// VS6 forgets to create the output directory for archives if it
// differs from the intermediate directory.
if(target.GetType() != cmTarget::STATIC_LIBRARY) { return pcc; }
- std::string outDir = target.GetDirectory(config, false);
+
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
+
+ std::string outDir = gt->GetDirectory(config, false);
// Add a pre-link event to create the directory.
cmCustomCommandLine command;
@@ -1363,20 +1367,20 @@ void cmLocalVisualStudio6Generator
#ifdef CM_USE_OLD_VS6
outputDirOld =
removeQuotes(this->ConvertToOutputFormat
- (target.GetDirectory().c_str(), SHELL));
+ (gt->GetDirectory().c_str(), SHELL));
#endif
outputDirDebug =
removeQuotes(this->ConvertToOutputFormat(
- target.GetDirectory("Debug").c_str(), SHELL));
+ gt->GetDirectory("Debug").c_str(), SHELL));
outputDirRelease =
removeQuotes(this->ConvertToOutputFormat(
- target.GetDirectory("Release").c_str(), SHELL));
+ gt->GetDirectory("Release").c_str(), SHELL));
outputDirMinSizeRel =
removeQuotes(this->ConvertToOutputFormat(
- target.GetDirectory("MinSizeRel").c_str(), SHELL));
+ gt->GetDirectory("MinSizeRel").c_str(), SHELL));
outputDirRelWithDebInfo =
removeQuotes(this->ConvertToOutputFormat(
- target.GetDirectory("RelWithDebInfo").c_str(), SHELL));
+ gt->GetDirectory("RelWithDebInfo").c_str(), SHELL));
}
else if(target.GetType() == cmTarget::OBJECT_LIBRARY)
{
@@ -1424,12 +1428,12 @@ void cmLocalVisualStudio6Generator
target.GetType() == cmTarget::MODULE_LIBRARY ||
target.GetType() == cmTarget::EXECUTABLE)
{
- std::string fullPathImpDebug = target.GetDirectory("Debug", true);
- std::string fullPathImpRelease = target.GetDirectory("Release", true);
+ std::string fullPathImpDebug = gt->GetDirectory("Debug", true);
+ std::string fullPathImpRelease = gt->GetDirectory("Release", true);
std::string fullPathImpMinSizeRel =
- target.GetDirectory("MinSizeRel", true);
+ gt->GetDirectory("MinSizeRel", true);
std::string fullPathImpRelWithDebInfo =
- target.GetDirectory("RelWithDebInfo", true);
+ gt->GetDirectory("RelWithDebInfo", true);
fullPathImpDebug += "/";
fullPathImpRelease += "/";
fullPathImpMinSizeRel += "/";
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 8924564..e7fe61e 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -792,7 +792,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
{
std::string const& outDir =
target.GetType() == cmTarget::OBJECT_LIBRARY?
- intermediateDir : target.GetDirectory(configName);
+ intermediateDir : gt->GetDirectory(configName);
fout << "\t\t\tOutputDirectory=\""
<< this->ConvertToXMLOutputPathSingle(outDir.c_str()) << "\"\n";
}
@@ -1004,7 +1004,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
// Check if we need the FAT32 workaround.
// Check the filesystem type where the target will be written.
- if (cmLVS6G_IsFAT(target.GetDirectory(configName).c_str()))
+ if (cmLVS6G_IsFAT(gt->GetDirectory(configName).c_str()))
{
// Add a flag telling the manifest tool to use a workaround
// for FAT32 file systems, which can cause an empty manifest
@@ -1130,7 +1130,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
case cmTarget::STATIC_LIBRARY:
{
std::string targetNameFull = gt->GetFullName(configName);
- std::string libpath = target.GetDirectory(configName);
+ std::string libpath = gt->GetDirectory(configName);
libpath += "/";
libpath += targetNameFull;
const char* tool = "VCLibrarianTool";
@@ -1210,7 +1210,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
fout << " ";
this->Internal->OutputLibraries(fout, cli.GetItems());
fout << "\"\n";
- temp = target.GetDirectory(configName);
+ temp = gt->GetDirectory(configName);
temp += "/";
temp += targetNameFull;
fout << "\t\t\t\tOutputFile=\""
@@ -1248,7 +1248,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
{
fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"\n";
}
- temp = target.GetDirectory(configName, true);
+ temp = gt->GetDirectory(configName, true);
temp += "/";
temp += targetNameImport;
fout << "\t\t\t\tImportLibrary=\""
@@ -1309,7 +1309,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
fout << " ";
this->Internal->OutputLibraries(fout, cli.GetItems());
fout << "\"\n";
- temp = target.GetDirectory(configName);
+ temp = gt->GetDirectory(configName);
temp += "/";
temp += targetNameFull;
fout << "\t\t\t\tOutputFile=\""
@@ -1367,7 +1367,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
{
fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"";
}
- temp = target.GetDirectory(configName, true);
+ temp = gt->GetDirectory(configName, true);
temp += "/";
temp += targetNameImport;
fout << "\t\t\t\tImportLibrary=\""
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index c0072de..c830a82 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -92,8 +92,10 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
if(target.GetType() != cmTarget::EXECUTABLE &&
!(isFortran && target.GetType() == cmTarget::SHARED_LIBRARY))
{ return pcc; }
- std::string outDir = target.GetDirectory(config, false);
- std::string impDir = target.GetDirectory(config, true);
+ cmGeneratorTarget* gt =
+ this->GetGlobalGenerator()->GetGeneratorTarget(&target);
+ std::string outDir = gt->GetDirectory(config, false);
+ std::string impDir = gt->GetDirectory(config, true);
if(impDir == outDir) { return pcc; }
// Add a pre-build event to create the directory.
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 90f679e..eebee83 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -99,7 +99,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->ConfigName);
// Construct the full path version of the names.
- std::string outpath = this->Target->GetDirectory(this->ConfigName);
+ std::string outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
if(this->Target->IsAppBundleOnApple())
{
this->OSXBundleGenerator->CreateAppBundle(targetName, outpath);
@@ -123,7 +123,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
cmSystemTools::MakeDirectory(outpath.c_str());
if(!targetNameImport.empty())
{
- outpathImp = this->Target->GetDirectory(this->ConfigName, true);
+ outpathImp = this->GeneratorTarget->GetDirectory(this->ConfigName, true);
cmSystemTools::MakeDirectory(outpathImp.c_str());
outpathImp += "/";
}
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index cd387a0..d12142a 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -275,13 +275,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::string outpathImp;
if(this->Target->IsFrameworkOnApple())
{
- outpath = this->Target->GetDirectory(this->ConfigName);
+ outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
this->OSXBundleGenerator->CreateFramework(targetName, outpath);
outpath += "/";
}
else if(this->Target->IsCFBundleOnApple())
{
- outpath = this->Target->GetDirectory(this->ConfigName);
+ outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
this->OSXBundleGenerator->CreateCFBundle(targetName, outpath);
outpath += "/";
}
@@ -299,12 +299,12 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
}
else
{
- outpath = this->Target->GetDirectory(this->ConfigName);
+ outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
cmSystemTools::MakeDirectory(outpath.c_str());
outpath += "/";
if(!targetNameImport.empty())
{
- outpathImp = this->Target->GetDirectory(this->ConfigName, true);
+ outpathImp = this->GeneratorTarget->GetDirectory(this->ConfigName, true);
cmSystemTools::MakeDirectory(outpathImp.c_str());
outpathImp += "/";
}
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 24fcaf4..f8743d9 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -59,7 +59,7 @@ cmNinjaNormalTargetGenerator(cmGeneratorTarget* target)
{
// on Windows the output dir is already needed at compile time
// ensure the directory exists (OutDir test)
- EnsureDirectoryExists(target->Target->GetDirectory(this->GetConfigName()));
+ EnsureDirectoryExists(target->GetDirectory(this->GetConfigName()));
}
this->OSXBundleGenerator = new cmOSXBundleGenerator(target,
@@ -413,7 +413,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
if (target.IsAppBundleOnApple())
{
// Create the app bundle
- std::string outpath = target.GetDirectory(cfgName);
+ std::string outpath = gt.GetDirectory(cfgName);
this->OSXBundleGenerator->CreateAppBundle(this->TargetNameOut, outpath);
// Calculate the output path
@@ -430,13 +430,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
{
// Create the library framework.
this->OSXBundleGenerator->CreateFramework(this->TargetNameOut,
- target.GetDirectory(cfgName));
+ gt.GetDirectory(cfgName));
}
else if(target.IsCFBundleOnApple())
{
// Create the core foundation bundle.
this->OSXBundleGenerator->CreateCFBundle(this->TargetNameOut,
- target.GetDirectory(cfgName));
+ gt.GetDirectory(cfgName));
}
// Write comments.
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 6e6dc60..33e08a3 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -254,7 +254,7 @@ cmNinjaTargetGenerator
std::string cmNinjaTargetGenerator::GetTargetOutputDir() const
{
- std::string dir = this->Target->GetDirectory(this->GetConfigName());
+ std::string dir = this->GeneratorTarget->GetDirectory(this->GetConfigName());
return ConvertToNinjaPath(dir);
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 825f3eb..0f8b3b0 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1771,25 +1771,6 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetDirectory(const std::string& config,
- bool implib) const
-{
- if (this->IsImported())
- {
- // Return the directory from which the target is imported.
- return
- cmSystemTools::GetFilenamePath(
- this->ImportedGetFullPath(config, implib));
- }
- else if(OutputInfo const* info = this->GetOutputInfo(config))
- {
- // Return the directory in which the target will be built.
- return implib? info->ImpDir : info->OutDir;
- }
- return "";
-}
-
-//----------------------------------------------------------------------------
std::string cmTarget::GetPDBDirectory(const std::string& config) const
{
if(OutputInfo const* info = this->GetOutputInfo(config))
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 96cdb5e..507ea7d 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -231,13 +231,6 @@ public:
the link dependencies of this target. */
std::string CheckCMP0004(std::string const& item) const;
- /** Get the directory in which this target will be built. If the
- configuration name is given then the generator will add its
- subdirectory for that configuration. Otherwise just the canonical
- output directory is given. */
- std::string GetDirectory(const std::string& config = "",
- bool implib = false) const;
-
/** Get the directory in which this targets .pdb files will be placed.
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 2395ce7..4c9b82b 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1780,7 +1780,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
}
else
{
- outDir = this->Target->GetDirectory(config->c_str()) + "/";
+ outDir = this->GeneratorTarget->GetDirectory(config->c_str()) + "/";
targetNameFull = this->GeneratorTarget->GetFullName(config->c_str());
}
this->ConvertToWindowsSlash(intermediateDir);
@@ -2584,7 +2584,8 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
std::string pdb = this->Target->GetPDBDirectory(config.c_str());
pdb += "/";
pdb += targetNamePDB;
- std::string imLib = this->Target->GetDirectory(config.c_str(), true);
+ std::string imLib =
+ this->GeneratorTarget->GetDirectory(config.c_str(), true);
imLib += "/";
imLib += targetNameImport;