cmTarget: Add per-config compilation info
Add a cmTarget::CompileInfo struct to hold per-configuration information about the compilation settings in a target. This is different than cmTarget::OutputInfo because it applies to any targets that can compile sources even if they do not link or archive.
This commit is contained in:
parent
718a9532c6
commit
3737860a38
|
@ -71,6 +71,11 @@ struct cmTarget::ImportInfo
|
||||||
cmTarget::LinkInterface LinkInterface;
|
cmTarget::LinkInterface LinkInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
struct cmTarget::CompileInfo
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
struct TargetConfigPair : public std::pair<cmTarget const* , std::string> {
|
struct TargetConfigPair : public std::pair<cmTarget const* , std::string> {
|
||||||
TargetConfigPair(cmTarget const* tgt, const std::string &config)
|
TargetConfigPair(cmTarget const* tgt, const std::string &config)
|
||||||
: std::pair<cmTarget const* , std::string>(tgt, config) {}
|
: std::pair<cmTarget const* , std::string>(tgt, config) {}
|
||||||
|
@ -116,6 +121,9 @@ public:
|
||||||
ImportInfoMapType;
|
ImportInfoMapType;
|
||||||
ImportInfoMapType ImportInfoMap;
|
ImportInfoMapType ImportInfoMap;
|
||||||
|
|
||||||
|
typedef std::map<std::string, cmTarget::CompileInfo> CompileInfoMapType;
|
||||||
|
CompileInfoMapType CompileInfoMap;
|
||||||
|
|
||||||
// Cache link implementation computation from each configuration.
|
// Cache link implementation computation from each configuration.
|
||||||
typedef std::map<TargetConfigPair,
|
typedef std::map<TargetConfigPair,
|
||||||
cmTarget::LinkImplementation> LinkImplMapType;
|
cmTarget::LinkImplementation> LinkImplMapType;
|
||||||
|
@ -2477,6 +2485,44 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const
|
||||||
return &i->second;
|
return &i->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* 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);
|
||||||
|
abort();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lookup/compute/cache the compile information for this configuration.
|
||||||
|
std::string config_upper;
|
||||||
|
if(config && *config)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
CompileInfoMapType::value_type entry(config_upper, info);
|
||||||
|
i = this->Internal->CompileInfoMap.insert(entry).first;
|
||||||
|
}
|
||||||
|
return &i->second;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string cmTarget::GetDirectory(const char* config, bool implib) const
|
std::string cmTarget::GetDirectory(const char* config, bool implib) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -720,6 +720,10 @@ private:
|
||||||
void ComputeImportInfo(std::string const& desired_config, ImportInfo& info,
|
void ComputeImportInfo(std::string const& desired_config, ImportInfo& info,
|
||||||
cmTarget const* head) const;
|
cmTarget const* head) const;
|
||||||
|
|
||||||
|
// Cache target compile paths for each configuration.
|
||||||
|
struct CompileInfo;
|
||||||
|
CompileInfo const* GetCompileInfo(const char* config) const;
|
||||||
|
|
||||||
mutable cmTargetLinkInformationMap LinkInformation;
|
mutable cmTargetLinkInformationMap LinkInformation;
|
||||||
void CheckPropertyCompatibility(cmComputeLinkInformation *info,
|
void CheckPropertyCompatibility(cmComputeLinkInformation *info,
|
||||||
const char* config) const;
|
const char* config) const;
|
||||||
|
|
Loading…
Reference in New Issue