cmGeneratorTarget: Move GetSupportDirectory from cmTarget.

This commit is contained in:
Stephen Kelly 2015-10-10 00:29:47 +02:00
parent 526cc7dc52
commit ce75c86ec3
12 changed files with 38 additions and 39 deletions

View File

@ -5512,3 +5512,18 @@ bool cmGeneratorTarget::HasImportLibrary() const
(this->GetType() == cmTarget::SHARED_LIBRARY ||
this->Target->IsExecutableWithExports()));
}
//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetSupportDirectory() const
{
std::string dir = this->Makefile->GetCurrentBinaryDirectory();
dir += cmake::GetCMakeFilesDirectory();
dir += "/";
dir += this->GetName();
#if defined(__VMS)
dir += "_dir";
#else
dir += ".dir";
#endif
return dir;
}

View File

@ -401,6 +401,9 @@ public:
/** Return whether or not the target has a DLL import library. */
bool HasImportLibrary() const;
/** Get a build-tree directory in which to place target support files. */
std::string GetSupportDirectory() const;
struct SourceFileFlags
GetTargetSourceFileFlags(const cmSourceFile* sf) const;

View File

@ -2893,13 +2893,14 @@ void cmGlobalGenerator::WriteSummary()
{
continue;
}
this->WriteSummary(ti->second);
fout << ti->second->GetSupportDirectory() << "\n";
cmGeneratorTarget* gt = this->GetGeneratorTarget(ti->second);
this->WriteSummary(gt);
fout << gt->GetSupportDirectory() << "\n";
}
}
//----------------------------------------------------------------------------
void cmGlobalGenerator::WriteSummary(cmTarget* target)
void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
{
// Place the labels file in a per-target support directory.
std::string dir = target->GetSupportDirectory();
@ -2942,17 +2943,15 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target)
fout << "# Source files and their labels\n";
std::vector<cmSourceFile*> sources;
std::vector<std::string> configs;
target->GetMakefile()->GetConfigurations(configs);
target->Target->GetMakefile()->GetConfigurations(configs);
if (configs.empty())
{
configs.push_back("");
}
cmGeneratorTarget* gt =
this->GetGeneratorTarget(target);
for(std::vector<std::string>::const_iterator ci = configs.begin();
ci != configs.end(); ++ci)
{
gt->GetSourceFiles(sources, *ci);
target->GetSourceFiles(sources, *ci);
}
std::vector<cmSourceFile*>::const_iterator sourcesEnd
= cmRemoveDuplicates(sources);

View File

@ -458,7 +458,7 @@ private:
void WriteRuleHashes(std::string const& pfile);
void WriteSummary();
void WriteSummary(cmTarget* target);
void WriteSummary(cmGeneratorTarget* target);
void FinalizeTargetCompileInfo();
virtual void ForceLinkerLanguages();

View File

@ -361,7 +361,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.CMTarget = this->Target;
vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->Target->GetSupportDirectory();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
objectDir = this->Convert(objectDir,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);

View File

@ -572,7 +572,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
if(this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{
std::string name_of_def_file =
this->Target->GetSupportDirectory();
this->GeneratorTarget->GetSupportDirectory();
name_of_def_file += std::string("/") +
this->Target->GetName();
name_of_def_file += ".def";
@ -643,7 +643,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
vars.CMTarget = this->Target;
vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->Target->GetSupportDirectory();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
objectDir = this->Convert(objectDir,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);

View File

@ -557,7 +557,8 @@ cmMakefileTargetGenerator
this->GeneratorTarget->GetCompilePDBPath(this->ConfigName);
if(targetFullPathCompilePDB.empty())
{
targetFullPathCompilePDB = this->Target->GetSupportDirectory() + "/";
targetFullPathCompilePDB =
this->GeneratorTarget->GetSupportDirectory() + "/";
}
}
@ -594,7 +595,7 @@ cmMakefileTargetGenerator
cmLocalGenerator::NONE,
cmLocalGenerator::SHELL);
vars.Object = shellObj.c_str();
std::string objectDir = this->Target->GetSupportDirectory();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
objectDir = this->Convert(objectDir,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);

View File

@ -492,9 +492,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
{
if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{
std::string dllname = targetOutput;
std::string name_of_def_file
= target.GetSupportDirectory();
= gt.GetSupportDirectory();
name_of_def_file += "/" + target.GetName();
name_of_def_file += ".def ";
vars["LINK_FLAGS"] += " /DEF:";
@ -582,7 +581,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["TARGET_PDB"] = base + suffix + dbg_suffix;
}
const std::string objPath = GetTarget()->GetSupportDirectory();
const std::string objPath = GetGeneratorTarget()->GetSupportDirectory();
vars["OBJECT_DIR"] =
this->GetLocalGenerator()->ConvertToOutputFormat(
this->ConvertToNinjaPath(objPath), cmLocalGenerator::SHELL);
@ -634,7 +633,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
std::string name_of_def_file
= target.GetSupportDirectory();
= gt.GetSupportDirectory();
name_of_def_file += "/" + target.GetName();
name_of_def_file += ".def";
std::string cmd = cmakeCommand;

View File

@ -298,7 +298,7 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
this->GeneratorTarget->GetCompilePDBPath(this->GetConfigName());
if(compilePdbPath.empty())
{
compilePdbPath = this->Target->GetSupportDirectory() + "/";
compilePdbPath = this->GeneratorTarget->GetSupportDirectory() + "/";
}
}
@ -567,7 +567,7 @@ cmNinjaTargetGenerator
std::string const language = source->GetLanguage();
std::string const sourceFileName =
language=="RC" ? source->GetFullPath() : this->GetSourceFilePath(source);
std::string const objectDir = this->Target->GetSupportDirectory();
std::string const objectDir = this->GeneratorTarget->GetSupportDirectory();
std::string const objectFileName = this->GetObjectFilePath(source);
std::string const objectFileDir =
cmSystemTools::GetFilenamePath(objectFileName);

View File

@ -64,7 +64,7 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
std::string basename = cmsys::SystemTools::
GetFilenameWithoutLastExtension(absFile);
std::string rcc_output_dir = target->Target->GetSupportDirectory();
std::string rcc_output_dir = target->GetSupportDirectory();
cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
std::string rcc_output_file = rcc_output_dir;
rcc_output_file += "/qrc_" + basename + ".cpp";
@ -833,7 +833,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
std::string basename = cmsys::SystemTools::
GetFilenameWithoutLastExtension(absFile);
std::string rcc_output_dir = target->Target->GetSupportDirectory();
std::string rcc_output_dir = target->GetSupportDirectory();
cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
std::string rcc_output_file = rcc_output_dir;
rcc_output_file += "/qrc_" + basename + ".cpp";

View File

@ -381,21 +381,6 @@ cmListFileBacktrace const& cmTarget::GetBacktrace() const
return this->Internal->Backtrace;
}
//----------------------------------------------------------------------------
std::string cmTarget::GetSupportDirectory() const
{
std::string dir = this->Makefile->GetCurrentBinaryDirectory();
dir += cmake::GetCMakeFilesDirectory();
dir += "/";
dir += this->Name;
#if defined(__VMS)
dir += "_dir";
#else
dir += ".dir";
#endif
return dir;
}
//----------------------------------------------------------------------------
bool cmTarget::IsExecutableWithExports() const
{

View File

@ -282,9 +282,6 @@ public:
/** Get a backtrace from the creation of the target. */
cmListFileBacktrace const& GetBacktrace() const;
/** Get a build-tree directory in which to place target support files. */
std::string GetSupportDirectory() const;
/** @return whether this target have a well defined output file name. */
bool HaveWellDefinedOutputFiles() const;