ENH: Moved GetTargetDirectory method up to cmLocalGenerator. This provides a common interface to something that was implemented in most local generators anyway.

This commit is contained in:
Brad King 2007-08-01 15:25:40 -04:00
parent 2246e0336d
commit ea874415d9
10 changed files with 39 additions and 4 deletions

View File

@ -2772,6 +2772,18 @@ std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars,
}
return std::string(&arg[0]);
}
//----------------------------------------------------------------------------
std::string
cmLocalGenerator::GetTargetDirectory(cmTarget const&) const
{
cmSystemTools::Error("GetTargetDirectory"
" called on cmLocalGenerator");
return "";
}
//----------------------------------------------------------------------------
void
cmLocalGenerator::GetTargetObjectFileDirectories(cmTarget* ,
std::vector<std::string>&

View File

@ -236,6 +236,12 @@ public:
std::string ConvertToRelativePath(const std::vector<std::string>& local,
const char* remote);
/**
* Get the relative path from the generator output directory to a
* per-target support directory.
*/
virtual std::string GetTargetDirectory(cmTarget const& target) const;
protected:
/** Construct a comment for a custom command. */

View File

@ -1897,7 +1897,8 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p)
//----------------------------------------------------------------------------
std::string
cmLocalUnixMakefileGenerator3::GetTargetDirectory(cmTarget& target)
cmLocalUnixMakefileGenerator3
::GetTargetDirectory(cmTarget const& target) const
{
std::string dir = cmake::GetCMakeFilesDirectoryPostSlash();
dir += target.GetName();

View File

@ -188,7 +188,7 @@ public:
void AppendEcho(std::vector<std::string>& commands, const char* text,
EchoColor color = EchoNormal);
static std::string GetTargetDirectory(cmTarget& target);
virtual std::string GetTargetDirectory(cmTarget const& target) const;
// create a command that cds to the start dir then runs the commands
void CreateCDCommand(std::vector<std::string>& commands,

View File

@ -1567,6 +1567,13 @@ void cmLocalVisualStudio6Generator
}
}
std::string
cmLocalVisualStudio6Generator
::GetTargetDirectory(cmTarget const&) const
{
// No per-target directory for this generator (yet).
return "";
}
void cmLocalVisualStudio6Generator
::GetTargetObjectFileDirectories(cmTarget* ,

View File

@ -62,6 +62,7 @@ public:
{
return this->CreatedProjectNames;
}
virtual std::string GetTargetDirectory(cmTarget const& target) const;
void GetTargetObjectFileDirectories(cmTarget* target,
std::vector<std::string>&
dirs);

View File

@ -1619,7 +1619,7 @@ void cmLocalVisualStudio7Generator::ConfigureFinalPass()
//----------------------------------------------------------------------------
std::string cmLocalVisualStudio7Generator
::GetTargetDirectory(cmTarget& target)
::GetTargetDirectory(cmTarget const& target) const
{
std::string dir;
dir += target.GetName();

View File

@ -113,7 +113,7 @@ private:
void WriteGroup(const cmSourceGroup *sg,
cmTarget target, std::ostream &fout,
const char *libName, std::vector<std::string> *configs);
virtual std::string GetTargetDirectory(cmTarget&);
virtual std::string GetTargetDirectory(cmTarget const&) const;
cmVS7FlagTable const* ExtraFlagTable;
std::string ModuleDefinitionFile;

View File

@ -13,6 +13,13 @@ cmLocalXCodeGenerator::~cmLocalXCodeGenerator()
{
}
std::string
cmLocalXCodeGenerator::GetTargetDirectory(cmTarget const&) const
{
// No per-target directory for this generator (yet).
return "";
}
void cmLocalXCodeGenerator::
GetTargetObjectFileDirectories(cmTarget* target,
std::vector<std::string>&

View File

@ -35,6 +35,7 @@ public:
void GetTargetObjectFileDirectories(cmTarget* target,
std::vector<std::string>&
dirs);
virtual std::string GetTargetDirectory(cmTarget const& target) const;
private:
};