cmGeneratorTarget: Move CompileInfoMap from cmTarget.

This commit is contained in:
Stephen Kelly 2015-08-04 19:19:51 +02:00
parent b3f0e35308
commit f83e84028a
4 changed files with 51 additions and 50 deletions

View File

@ -1356,6 +1356,46 @@ cmGeneratorTarget::GetMacContentDirectory(const std::string& config,
return fpath;
}
//----------------------------------------------------------------------------
cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
const std::string& config) const
{
// There is no compile information for imported targets.
if(this->IsImported())
{
return 0;
}
if(this->GetType() > cmTarget::OBJECT_LIBRARY)
{
std::string msg = "cmTarget::GetCompileInfo called for ";
msg += this->GetName();
msg += " which has type ";
msg += cmTarget::GetTargetTypeName(this->Target->GetType());
this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, msg);
return 0;
}
// Lookup/compute/cache the compile information for this configuration.
std::string config_upper;
if(!config.empty())
{
config_upper = cmSystemTools::UpperCase(config);
}
CompileInfoMapType::const_iterator i =
this->CompileInfoMap.find(config_upper);
if(i == this->CompileInfoMap.end())
{
CompileInfo info;
this->Target
->ComputePDBOutputDir("COMPILE_PDB", config, info.CompilePdbDir);
CompileInfoMapType::value_type entry(config_upper, info);
i = this->CompileInfoMap.insert(entry).first;
}
return &i->second;
}
//----------------------------------------------------------------------------
std::string
cmGeneratorTarget::GetModuleDefinitionFile(const std::string& config) const
@ -1827,7 +1867,7 @@ void cmGeneratorTarget::TraceDependencies()
std::string
cmGeneratorTarget::GetCompilePDBDirectory(const std::string& config) const
{
if(cmTarget::CompileInfo const* info = this->Target->GetCompileInfo(config))
if(CompileInfo const* info = this->GetCompileInfo(config))
{
return info->CompilePdbDir;
}

View File

@ -230,6 +230,16 @@ public:
/** Whether this library has soname enabled and platform supports it. */
bool HasSOName(const std::string& config) const;
struct CompileInfo
{
std::string CompilePdbDir;
};
CompileInfo const* GetCompileInfo(const std::string& config) const;
typedef std::map<std::string, CompileInfo> CompileInfoMapType;
mutable CompileInfoMapType CompileInfoMap;
/** Get the name of the compiler pdb file for the target. */
std::string GetCompilePDBName(const std::string& config="") const;

View File

@ -126,9 +126,6 @@ public:
typedef std::map<std::string, cmTarget::ImportInfo> ImportInfoMapType;
ImportInfoMapType ImportInfoMap;
typedef std::map<std::string, cmTarget::CompileInfo> CompileInfoMapType;
CompileInfoMapType CompileInfoMap;
// Cache link implementation computation from each configuration.
struct OptionalLinkImplementation: public cmTarget::LinkImplementation
{
@ -2597,45 +2594,6 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(
return &i->second;
}
//----------------------------------------------------------------------------
cmTarget::CompileInfo const* cmTarget::GetCompileInfo(
const std::string& config) const
{
// There is no compile information for imported targets.
if(this->IsImported())
{
return 0;
}
if(this->GetType() > cmTarget::OBJECT_LIBRARY)
{
std::string msg = "cmTarget::GetCompileInfo called for ";
msg += this->GetName();
msg += " which has type ";
msg += cmTarget::GetTargetTypeName(this->GetType());
this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg);
return 0;
}
// Lookup/compute/cache the compile information for this configuration.
std::string config_upper;
if(!config.empty())
{
config_upper = cmSystemTools::UpperCase(config);
}
typedef cmTargetInternals::CompileInfoMapType CompileInfoMapType;
CompileInfoMapType::const_iterator i =
this->Internal->CompileInfoMap.find(config_upper);
if(i == this->Internal->CompileInfoMap.end())
{
CompileInfo info;
this->ComputePDBOutputDir("COMPILE_PDB", config, info.CompilePdbDir);
CompileInfoMapType::value_type entry(config_upper, info);
i = this->Internal->CompileInfoMap.insert(entry).first;
}
return &i->second;
}
//----------------------------------------------------------------------------
std::string cmTarget::GetDirectory(const std::string& config,
bool implib) const

View File

@ -626,13 +626,6 @@ private:
void ComputeImportInfo(std::string const& desired_config,
ImportInfo& info) const;
// Cache target compile paths for each configuration.
struct CompileInfo
{
std::string CompilePdbDir;
};
CompileInfo const* GetCompileInfo(const std::string& config) const;
LinkInterface const*
GetImportLinkInterface(const std::string& config, cmTarget const* head,