cmGeneratorTarget: Move ComputePDBOutputDir from cmTarget.

This commit is contained in:
Stephen Kelly 2015-08-05 19:01:23 +02:00
parent 49017cddab
commit bf5eb4a3f3
4 changed files with 66 additions and 67 deletions

View File

@ -1780,8 +1780,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
if(i == this->CompileInfoMap.end()) if(i == this->CompileInfoMap.end())
{ {
CompileInfo info; CompileInfo info;
this->Target this->ComputePDBOutputDir("COMPILE_PDB", config, info.CompilePdbDir);
->ComputePDBOutputDir("COMPILE_PDB", config, info.CompilePdbDir);
CompileInfoMapType::value_type entry(config_upper, info); CompileInfoMapType::value_type entry(config_upper, info);
i = this->CompileInfoMap.insert(entry).first; i = this->CompileInfoMap.insert(entry).first;
} }
@ -4519,7 +4518,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
// Compute output directories. // Compute output directories.
this->ComputeOutputDir(config, false, info.OutDir); this->ComputeOutputDir(config, false, info.OutDir);
this->ComputeOutputDir(config, true, info.ImpDir); this->ComputeOutputDir(config, true, info.ImpDir);
if(!this->Target->ComputePDBOutputDir("PDB", config, info.PdbDir)) if(!this->ComputePDBOutputDir("PDB", config, info.PdbDir))
{ {
info.PdbDir = info.OutDir; info.PdbDir = info.OutDir;
} }
@ -4634,6 +4633,67 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
return usesDefaultOutputDir; return usesDefaultOutputDir;
} }
//----------------------------------------------------------------------------
bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
const std::string& config,
std::string& out) const
{
// Look for a target property defining the target output directory
// based on the target type.
const char* propertyName = 0;
std::string propertyNameStr = kind;
if(!propertyNameStr.empty())
{
propertyNameStr += "_OUTPUT_DIRECTORY";
propertyName = propertyNameStr.c_str();
}
std::string conf = config;
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(conf);
const char* configProp = 0;
std::string configPropStr = kind;
if(!configPropStr.empty())
{
configPropStr += "_OUTPUT_DIRECTORY_";
configPropStr += configUpper;
configProp = configPropStr.c_str();
}
// Select an output directory.
if(const char* config_outdir = this->GetProperty(configProp))
{
// Use the user-specified per-configuration output directory.
out = config_outdir;
// Skip per-configuration subdirectory.
conf = "";
}
else if(const char* outdir = this->GetProperty(propertyName))
{
// Use the user-specified output directory.
out = outdir;
}
if(out.empty())
{
return false;
}
// Convert the output path to a full path in case it is
// specified as a relative path. Treat a relative path as
// relative to the current output directory for this makefile.
out = (cmSystemTools::CollapseFullPath
(out, this->Makefile->GetCurrentBinaryDirectory()));
// The generator may add the configuration's subdirectory.
if(!conf.empty())
{
this->LocalGenerator->GetGlobalGenerator()->
AppendDirectoryForConfig("/", conf, "", out);
}
return true;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmGeneratorTarget::ComputeLinkInterfaceLibraries( cmGeneratorTarget::ComputeLinkInterfaceLibraries(

View File

@ -528,6 +528,9 @@ private:
mutable bool DebugSourcesDone; mutable bool DebugSourcesDone;
mutable bool LinkImplementationLanguageIsContextDependent; mutable bool LinkImplementationLanguageIsContextDependent;
bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
std::string& out) const;
public: public:
std::vector<cmTarget const*> const& std::vector<cmTarget const*> const&
GetLinkImplementationClosure(const std::string& config) const; GetLinkImplementationClosure(const std::string& config) const;

View File

@ -2447,67 +2447,6 @@ const char* cmTarget::GetOutputTargetType(bool implib) const
return ""; return "";
} }
//----------------------------------------------------------------------------
bool cmTarget::ComputePDBOutputDir(const std::string& kind,
const std::string& config,
std::string& out) const
{
// Look for a target property defining the target output directory
// based on the target type.
const char* propertyName = 0;
std::string propertyNameStr = kind;
if(!propertyNameStr.empty())
{
propertyNameStr += "_OUTPUT_DIRECTORY";
propertyName = propertyNameStr.c_str();
}
std::string conf = config;
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(conf);
const char* configProp = 0;
std::string configPropStr = kind;
if(!configPropStr.empty())
{
configPropStr += "_OUTPUT_DIRECTORY_";
configPropStr += configUpper;
configProp = configPropStr.c_str();
}
// Select an output directory.
if(const char* config_outdir = this->GetProperty(configProp))
{
// Use the user-specified per-configuration output directory.
out = config_outdir;
// Skip per-configuration subdirectory.
conf = "";
}
else if(const char* outdir = this->GetProperty(propertyName))
{
// Use the user-specified output directory.
out = outdir;
}
if(out.empty())
{
return false;
}
// Convert the output path to a full path in case it is
// specified as a relative path. Treat a relative path as
// relative to the current output directory for this makefile.
out = (cmSystemTools::CollapseFullPath
(out, this->Makefile->GetCurrentBinaryDirectory()));
// The generator may add the configuration's subdirectory.
if(!conf.empty())
{
this->Makefile->GetGlobalGenerator()->
AppendDirectoryForConfig("/", conf, "", out);
}
return true;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmTarget::GetFrameworkVersion() const std::string cmTarget::GetFrameworkVersion() const
{ {

View File

@ -467,9 +467,6 @@ private:
bool LinkLibrariesForVS6Analyzed; bool LinkLibrariesForVS6Analyzed;
#endif #endif
bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
std::string& out) const;
// Cache import information from properties for each configuration. // Cache import information from properties for each configuration.
struct ImportInfo struct ImportInfo
{ {