cmGlobalGenerator: Make some API const.
This commit is contained in:
parent
8fd0f2a718
commit
8aeddf1f03
|
@ -782,13 +782,16 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const char*
|
const char*
|
||||||
cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source)
|
cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const
|
||||||
{
|
{
|
||||||
if(const char* lang = source.GetLanguage())
|
if(const char* lang = source.GetLanguage())
|
||||||
{
|
{
|
||||||
if(this->LanguageToOutputExtension.count(lang) > 0)
|
std::map<cmStdString, cmStdString>::const_iterator it =
|
||||||
|
this->LanguageToOutputExtension.find(lang);
|
||||||
|
|
||||||
|
if(it != this->LanguageToOutputExtension.end())
|
||||||
{
|
{
|
||||||
return this->LanguageToOutputExtension[lang].c_str();
|
return it->second.c_str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -809,7 +812,7 @@ cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext)
|
const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const
|
||||||
{
|
{
|
||||||
// if there is an extension and it starts with . then move past the
|
// if there is an extension and it starts with . then move past the
|
||||||
// . because the extensions are not stored with a . in the map
|
// . because the extensions are not stored with a . in the map
|
||||||
|
@ -817,9 +820,11 @@ const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext)
|
||||||
{
|
{
|
||||||
++ext;
|
++ext;
|
||||||
}
|
}
|
||||||
if(this->ExtensionToLanguage.count(ext) > 0)
|
std::map<cmStdString, cmStdString>::const_iterator it
|
||||||
|
= this->ExtensionToLanguage.find(ext);
|
||||||
|
if(it != this->ExtensionToLanguage.end())
|
||||||
{
|
{
|
||||||
return this->ExtensionToLanguage[ext].c_str();
|
return it->second.c_str();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -943,7 +948,7 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const char* l,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGlobalGenerator::IgnoreFile(const char* l)
|
bool cmGlobalGenerator::IgnoreFile(const char* l) const
|
||||||
{
|
{
|
||||||
if(this->GetLanguageFromExtension(l))
|
if(this->GetLanguageFromExtension(l))
|
||||||
{
|
{
|
||||||
|
@ -966,15 +971,22 @@ bool cmGlobalGenerator::IsDependedOn(const char* project,
|
||||||
cmTarget const* targetIn)
|
cmTarget const* targetIn)
|
||||||
{
|
{
|
||||||
// Get all local gens for this project
|
// Get all local gens for this project
|
||||||
std::vector<cmLocalGenerator*>* gens = &this->ProjectMap[project];
|
std::map<cmStdString, std::vector<cmLocalGenerator*> >::const_iterator it =
|
||||||
// loop over local gens and get the targets for each one
|
this->ProjectMap.find(project);
|
||||||
for(unsigned int i = 0; i < gens->size(); ++i)
|
if (it == this->ProjectMap.end())
|
||||||
{
|
{
|
||||||
cmTargets& targets = (*gens)[i]->GetMakefile()->GetTargets();
|
return false;
|
||||||
for (cmTargets::iterator l = targets.begin();
|
}
|
||||||
|
|
||||||
|
// loop over local gens and get the targets for each one
|
||||||
|
for(std::vector<cmLocalGenerator*>::const_iterator geIt = it->second.begin();
|
||||||
|
geIt != it->second.end(); ++geIt)
|
||||||
|
{
|
||||||
|
cmTargets const& targets = (*geIt)->GetMakefile()->GetTargets();
|
||||||
|
for (cmTargets::const_iterator l = targets.begin();
|
||||||
l != targets.end(); l++)
|
l != targets.end(); l++)
|
||||||
{
|
{
|
||||||
cmTarget& target = l->second;
|
cmTarget const& target = l->second;
|
||||||
TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
|
TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
|
||||||
if(tgtdeps.count(targetIn))
|
if(tgtdeps.count(targetIn))
|
||||||
{
|
{
|
||||||
|
@ -1897,7 +1909,7 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
||||||
cmLocalGenerator* gen)
|
cmLocalGenerator* gen) const
|
||||||
{
|
{
|
||||||
if(!gen || gen == root)
|
if(!gen || gen == root)
|
||||||
{
|
{
|
||||||
|
@ -1917,7 +1929,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
||||||
cmTarget& target)
|
cmTarget const& target) const
|
||||||
{
|
{
|
||||||
if(target.GetType() == cmTarget::INTERFACE_LIBRARY
|
if(target.GetType() == cmTarget::INTERFACE_LIBRARY
|
||||||
|| target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
|
|| target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
|
||||||
|
@ -1933,16 +1945,17 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang)
|
void
|
||||||
|
cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang) const
|
||||||
{
|
{
|
||||||
for(std::map<cmStdString, bool>::iterator i =
|
for(std::map<cmStdString, bool>::const_iterator i =
|
||||||
this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i)
|
this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i)
|
||||||
{
|
{
|
||||||
lang.push_back(i->first);
|
lang.push_back(i->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmGlobalGenerator::GetLinkerPreference(const char* lang)
|
int cmGlobalGenerator::GetLinkerPreference(const char* lang) const
|
||||||
{
|
{
|
||||||
std::map<cmStdString, int>::const_iterator it =
|
std::map<cmStdString, int>::const_iterator it =
|
||||||
this->LanguageToLinkerPreference.find(lang);
|
this->LanguageToLinkerPreference.find(lang);
|
||||||
|
@ -1988,10 +2001,10 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
|
||||||
{
|
{
|
||||||
cmLocalGenerator* lg = *lgi;
|
cmLocalGenerator* lg = *lgi;
|
||||||
cmMakefile* mf = lg->GetMakefile();
|
cmMakefile* mf = lg->GetMakefile();
|
||||||
cmTargets& targets = mf->GetTargets();
|
cmTargets const& targets = mf->GetTargets();
|
||||||
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
|
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
|
||||||
{
|
{
|
||||||
cmTarget& target = t->second;
|
cmTarget const& target = t->second;
|
||||||
|
|
||||||
// Consider the directory containing the target and all its
|
// Consider the directory containing the target and all its
|
||||||
// parents until something excludes the target.
|
// parents until something excludes the target.
|
||||||
|
@ -2020,15 +2033,16 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
|
||||||
|
|
||||||
|
|
||||||
///! Find a local generator by its startdirectory
|
///! Find a local generator by its startdirectory
|
||||||
cmLocalGenerator* cmGlobalGenerator::FindLocalGenerator(const char* start_dir)
|
cmLocalGenerator*
|
||||||
|
cmGlobalGenerator::FindLocalGenerator(const char* start_dir) const
|
||||||
{
|
{
|
||||||
std::vector<cmLocalGenerator*>* gens = &this->LocalGenerators;
|
for(std::vector<cmLocalGenerator*>::const_iterator it =
|
||||||
for(unsigned int i = 0; i < gens->size(); ++i)
|
this->LocalGenerators.begin(); it != this->LocalGenerators.end(); ++it)
|
||||||
{
|
{
|
||||||
std::string sd = (*gens)[i]->GetMakefile()->GetStartDirectory();
|
std::string sd = (*it)->GetMakefile()->GetStartDirectory();
|
||||||
if (sd == start_dir)
|
if (sd == start_dir)
|
||||||
{
|
{
|
||||||
return (*gens)[i];
|
return *it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2511,11 +2525,13 @@ cmGlobalGenerator::GenerateRuleFile(std::string const& output) const
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage(
|
std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage(
|
||||||
std::string const& l)
|
std::string const& l) const
|
||||||
{
|
{
|
||||||
if(this->LanguageToOriginalSharedLibFlags.count(l) > 0)
|
std::map<cmStdString, cmStdString>::const_iterator it =
|
||||||
|
this->LanguageToOriginalSharedLibFlags.find(l);
|
||||||
|
if(it != this->LanguageToOriginalSharedLibFlags.end())
|
||||||
{
|
{
|
||||||
return this->LanguageToOriginalSharedLibFlags[l];
|
return it->second;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -2646,7 +2662,7 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target)
|
bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target) const
|
||||||
{
|
{
|
||||||
return (target->GetType() == cmTarget::GLOBAL_TARGET ||
|
return (target->GetType() == cmTarget::GLOBAL_TARGET ||
|
||||||
strcmp(target->GetName(), this->GetAllTargetName()) == 0);
|
strcmp(target->GetName(), this->GetAllTargetName()) == 0);
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
void SetLanguageEnabled(const char*, cmMakefile* mf);
|
void SetLanguageEnabled(const char*, cmMakefile* mf);
|
||||||
bool GetLanguageEnabled(const char*) const;
|
bool GetLanguageEnabled(const char*) const;
|
||||||
void ClearEnabledLanguages();
|
void ClearEnabledLanguages();
|
||||||
void GetEnabledLanguages(std::vector<std::string>& lang);
|
void GetEnabledLanguages(std::vector<std::string>& lang) const;
|
||||||
/**
|
/**
|
||||||
* Try to determine system infomation such as shared library
|
* Try to determine system infomation such as shared library
|
||||||
* extension, pthreads, byte order etc.
|
* extension, pthreads, byte order etc.
|
||||||
|
@ -182,13 +182,13 @@ public:
|
||||||
bool GetToolSupportsColor() const { return this->ToolSupportsColor; }
|
bool GetToolSupportsColor() const { return this->ToolSupportsColor; }
|
||||||
|
|
||||||
///! return the language for the given extension
|
///! return the language for the given extension
|
||||||
const char* GetLanguageFromExtension(const char* ext);
|
const char* GetLanguageFromExtension(const char* ext) const;
|
||||||
///! is an extension to be ignored
|
///! is an extension to be ignored
|
||||||
bool IgnoreFile(const char* ext);
|
bool IgnoreFile(const char* ext) const;
|
||||||
///! What is the preference for linkers and this language (None or Prefered)
|
///! What is the preference for linkers and this language (None or Prefered)
|
||||||
int GetLinkerPreference(const char* lang);
|
int GetLinkerPreference(const char* lang) const;
|
||||||
///! What is the object file extension for a given source file?
|
///! What is the object file extension for a given source file?
|
||||||
const char* GetLanguageOutputExtension(cmSourceFile const&);
|
const char* GetLanguageOutputExtension(cmSourceFile const&) const;
|
||||||
|
|
||||||
///! What is the configurations directory variable called?
|
///! What is the configurations directory variable called?
|
||||||
virtual const char* GetCMakeCFGIntDir() const { return "."; }
|
virtual const char* GetCMakeCFGIntDir() const { return "."; }
|
||||||
|
@ -220,7 +220,7 @@ public:
|
||||||
target in the project */
|
target in the project */
|
||||||
bool IsDependedOn(const char* project, cmTarget const* target);
|
bool IsDependedOn(const char* project, cmTarget const* target);
|
||||||
///! Find a local generator by its startdirectory
|
///! Find a local generator by its startdirectory
|
||||||
cmLocalGenerator* FindLocalGenerator(const char* start_dir);
|
cmLocalGenerator* FindLocalGenerator(const char* start_dir) const;
|
||||||
|
|
||||||
/** Append the subdirectory for the given configuration. If anything is
|
/** Append the subdirectory for the given configuration. If anything is
|
||||||
appended the given prefix and suffix will be appended around it, which
|
appended the given prefix and suffix will be appended around it, which
|
||||||
|
@ -293,7 +293,7 @@ public:
|
||||||
i.e. "Can I build Debug and Release in the same tree?" */
|
i.e. "Can I build Debug and Release in the same tree?" */
|
||||||
virtual bool IsMultiConfig() { return false; }
|
virtual bool IsMultiConfig() { return false; }
|
||||||
|
|
||||||
std::string GetSharedLibFlagsForLanguage(std::string const& lang);
|
std::string GetSharedLibFlagsForLanguage(std::string const& lang) const;
|
||||||
|
|
||||||
/** Generate an <output>.rule file path for a given command output. */
|
/** Generate an <output>.rule file path for a given command output. */
|
||||||
virtual std::string GenerateRuleFile(std::string const& output) const;
|
virtual std::string GenerateRuleFile(std::string const& output) const;
|
||||||
|
@ -325,7 +325,7 @@ protected:
|
||||||
virtual void GetTargetSets(TargetDependSet& projectTargets,
|
virtual void GetTargetSets(TargetDependSet& projectTargets,
|
||||||
TargetDependSet& originalTargets,
|
TargetDependSet& originalTargets,
|
||||||
cmLocalGenerator* root, GeneratorVector const&);
|
cmLocalGenerator* root, GeneratorVector const&);
|
||||||
virtual bool IsRootOnlyTarget(cmTarget* target);
|
bool IsRootOnlyTarget(cmTarget* target) const;
|
||||||
void AddTargetDepends(cmTarget const* target,
|
void AddTargetDepends(cmTarget const* target,
|
||||||
TargetDependSet& projectTargets);
|
TargetDependSet& projectTargets);
|
||||||
void SetLanguageEnabledFlag(const char* l, cmMakefile* mf);
|
void SetLanguageEnabledFlag(const char* l, cmMakefile* mf);
|
||||||
|
@ -348,8 +348,8 @@ protected:
|
||||||
// has been populated.
|
// has been populated.
|
||||||
void FillProjectMap();
|
void FillProjectMap();
|
||||||
void CheckLocalGenerators();
|
void CheckLocalGenerators();
|
||||||
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen);
|
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
|
||||||
bool IsExcluded(cmLocalGenerator* root, cmTarget& target);
|
bool IsExcluded(cmLocalGenerator* root, cmTarget const& target) const;
|
||||||
void FillLocalGeneratorToTargetMap();
|
void FillLocalGeneratorToTargetMap();
|
||||||
void CreateDefaultGlobalTargets(cmTargets* targets);
|
void CreateDefaultGlobalTargets(cmTargets* targets);
|
||||||
cmTarget CreateGlobalTarget(const char* name, const char* message,
|
cmTarget CreateGlobalTarget(const char* name, const char* message,
|
||||||
|
|
Loading…
Reference in New Issue