cmGeneratorTarget: Move GetCompilePDBPath from cmTarget.

This commit is contained in:
Stephen Kelly 2015-08-04 19:19:45 +02:00
parent f0aa660772
commit a45fed81e5
8 changed files with 57 additions and 53 deletions

View File

@ -656,6 +656,51 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
this->Target->GetSourceFiles(files, config);
}
//----------------------------------------------------------------------------
std::string
cmGeneratorTarget::GetCompilePDBName(const std::string& config) const
{
std::string prefix;
std::string base;
std::string suffix;
this->Target->GetFullNameInternal(config, false, prefix, base, suffix);
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(config);
std::string configProp = "COMPILE_PDB_NAME_";
configProp += configUpper;
const char* config_name = this->Target->GetProperty(configProp);
if(config_name && *config_name)
{
return prefix + config_name + ".pdb";
}
const char* name = this->Target->GetProperty("COMPILE_PDB_NAME");
if(name && *name)
{
return prefix + name + ".pdb";
}
return "";
}
//----------------------------------------------------------------------------
std::string
cmGeneratorTarget::GetCompilePDBPath(const std::string& config) const
{
std::string dir = this->Target->GetCompilePDBDirectory(config);
std::string name = this->GetCompilePDBName(config);
if(dir.empty() && !name.empty())
{
dir = this->Target->GetPDBDirectory(config);
}
if(!dir.empty())
{
dir += "/";
}
return dir + name;
}
//----------------------------------------------------------------------------
bool cmGeneratorTarget::HasSOName(const std::string& config) const
{

View File

@ -163,6 +163,12 @@ public:
/** Whether this library has soname enabled and platform supports it. */
bool HasSOName(const std::string& config) const;
/** Get the name of the compiler pdb file for the target. */
std::string GetCompilePDBName(const std::string& config="") const;
/** Get the path for the MSVC /Fd option for this target. */
std::string GetCompilePDBPath(const std::string& config="") const;
/**
* Flags for a given source file as used in this target. Typically assigned
* via SET_TARGET_PROPERTIES when the property is a list of source files.

View File

@ -881,7 +881,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
if(target.GetType() <= cmTarget::OBJECT_LIBRARY)
{
// Specify the compiler program database file if configured.
std::string pdb = target.GetCompilePDBPath(configName);
std::string pdb = gt->GetCompilePDBPath(configName);
if(!pdb.empty())
{
fout << "\t\t\t\tProgramDataBaseFileName=\""

View File

@ -553,7 +553,7 @@ cmMakefileTargetGenerator
if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY)
{
targetFullPathCompilePDB =
this->Target->GetCompilePDBPath(this->ConfigName);
this->GeneratorTarget->GetCompilePDBPath(this->ConfigName);
if(targetFullPathCompilePDB.empty())
{
targetFullPathCompilePDB = this->Target->GetSupportDirectory() + "/";

View File

@ -277,7 +277,8 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
}
if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY)
{
compilePdbPath = this->Target->GetCompilePDBPath(this->GetConfigName());
compilePdbPath =
this->GeneratorTarget->GetCompilePDBPath(this->GetConfigName());
if(compilePdbPath.empty())
{
compilePdbPath = this->Target->GetSupportDirectory() + "/";

View File

@ -3491,49 +3491,6 @@ std::string cmTarget::GetPDBName(const std::string& config) const
return prefix+base+".pdb";
}
//----------------------------------------------------------------------------
std::string cmTarget::GetCompilePDBName(const std::string& config) const
{
std::string prefix;
std::string base;
std::string suffix;
this->GetFullNameInternal(config, false, prefix, base, suffix);
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(config);
std::string configProp = "COMPILE_PDB_NAME_";
configProp += configUpper;
const char* config_name = this->GetProperty(configProp);
if(config_name && *config_name)
{
return prefix + config_name + ".pdb";
}
const char* name = this->GetProperty("COMPILE_PDB_NAME");
if(name && *name)
{
return prefix + name + ".pdb";
}
return "";
}
//----------------------------------------------------------------------------
std::string cmTarget::GetCompilePDBPath(const std::string& config) const
{
std::string dir = this->GetCompilePDBDirectory(config);
std::string name = this->GetCompilePDBName(config);
if(dir.empty() && !name.empty())
{
dir = this->GetPDBDirectory(config);
}
if(!dir.empty())
{
dir += "/";
}
return dir + name;
}
//----------------------------------------------------------------------------
bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const
{

View File

@ -380,12 +380,6 @@ public:
/** Get the name of the pdb file for the target. */
std::string GetPDBName(const std::string& config) const;
/** Get the name of the compiler pdb file for the target. */
std::string GetCompilePDBName(const std::string& config="") const;
/** Get the path for the MSVC /Fd option for this target. */
std::string GetCompilePDBPath(const std::string& config="") const;
/** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const std::string& config) const;

View File

@ -2026,7 +2026,8 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
}
// Specify the compiler program database file if configured.
std::string pdb = this->Target->GetCompilePDBPath(configName.c_str());
std::string pdb =
this->GeneratorTarget->GetCompilePDBPath(configName.c_str());
if(!pdb.empty())
{
this->ConvertToWindowsSlash(pdb);