Merge topic 'constify'

bde0dab1 cmMakefile: Make ConfigureString const.
bf1e1bf1 cmMakefile: Make FindSourceGroup const.
01d7ceda cmMakefile: Trivially constify some methods.
9073318f cmMakefile: Remove non-const version of method
9b05bc4f cmMakefile: Remove method declarations with no implementation.
c6c0bd9d cmMakefile: Consify custom command API.
d6d4eaac cmMakefile: Constify policies accessors.
2a6e56e0 cmCacheManager: Consify version accessors.
5cc9fb02 cmSourceGroup: Fix method name capitalization.
fe8b0330 cmMakefile: Constify some cmSourceGroup related code.
e68a3ead cmSourceFile: Use a const cmMakefile.
b6292402 cmSourceFileLocation: Use a const cmMakefile.
b33ea578 cmMakefile: Make GetProperty const.
This commit is contained in:
Brad King 2014-01-27 13:03:39 -05:00 committed by CMake Topic Stage
commit ddb792daab
15 changed files with 137 additions and 141 deletions

View File

@ -145,8 +145,10 @@ public:
const char* GetCacheValue(const char* key) const; const char* GetCacheValue(const char* key) const;
/** Get the version of CMake that wrote the cache. */ /** Get the version of CMake that wrote the cache. */
unsigned int GetCacheMajorVersion() { return this->CacheMajorVersion; } unsigned int GetCacheMajorVersion() const
unsigned int GetCacheMinorVersion() { return this->CacheMinorVersion; } { return this->CacheMajorVersion; }
unsigned int GetCacheMinorVersion() const
{ return this->CacheMinorVersion; }
bool NeedCacheCompatibility(int major, int minor); bool NeedCacheCompatibility(int major, int minor);
protected: protected:

View File

@ -64,7 +64,7 @@ cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand(cmMakefile* mf, cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
const std::vector<std::string>& outputs, const std::vector<std::string>& outputs,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,

View File

@ -30,7 +30,7 @@ public:
cmCustomCommand& operator=(cmCustomCommand const& r); cmCustomCommand& operator=(cmCustomCommand const& r);
/** Main constructor specifies all information for the command. */ /** Main constructor specifies all information for the command. */
cmCustomCommand(cmMakefile* mf, cmCustomCommand(cmMakefile const* mf,
const std::vector<std::string>& outputs, const std::vector<std::string>& outputs,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,

View File

@ -567,9 +567,9 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
{ {
// Add the file to the list of sources. // Add the file to the list of sources.
std::string source = (*sfIt)->GetFullPath(); std::string source = (*sfIt)->GetFullPath();
cmSourceGroup& sourceGroup = cmSourceGroup* sourceGroup =
makefile->FindSourceGroup(source.c_str(), sourceGroups); makefile->FindSourceGroup(source.c_str(), sourceGroups);
sourceGroup.AssignSource(*sfIt); sourceGroup->AssignSource(*sfIt);
} }
for(std::vector<cmSourceGroup>::iterator sgIt = sourceGroups.begin(); for(std::vector<cmSourceGroup>::iterator sgIt = sourceGroups.begin();

View File

@ -2960,10 +2960,10 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
cmSourceFile* sf = *s; cmSourceFile* sf = *s;
// Add the file to the list of sources. // Add the file to the list of sources.
std::string const& source = sf->GetFullPath(); std::string const& source = sf->GetFullPath();
cmSourceGroup& sourceGroup = cmSourceGroup* sourceGroup =
mf->FindSourceGroup(source.c_str(), sourceGroups); mf->FindSourceGroup(source.c_str(), sourceGroups);
cmXCodeObject* pbxgroup = cmXCodeObject* pbxgroup =
this->CreateOrGetPBXGroup(cmtarget, &sourceGroup); this->CreateOrGetPBXGroup(cmtarget, sourceGroup);
cmStdString key = GetGroupMapKey(cmtarget, sf); cmStdString key = GetGroupMapKey(cmtarget, sf);
this->GroupMap[key] = pbxgroup; this->GroupMap[key] = pbxgroup;
} }
@ -2975,10 +2975,10 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
oi = objs.begin(); oi != objs.end(); ++oi) oi = objs.begin(); oi != objs.end(); ++oi)
{ {
std::string const& source = *oi; std::string const& source = *oi;
cmSourceGroup& sourceGroup = cmSourceGroup* sourceGroup =
mf->FindSourceGroup(source.c_str(), sourceGroups); mf->FindSourceGroup(source.c_str(), sourceGroups);
cmXCodeObject* pbxgroup = cmXCodeObject* pbxgroup =
this->CreateOrGetPBXGroup(cmtarget, &sourceGroup); this->CreateOrGetPBXGroup(cmtarget, sourceGroup);
cmStdString key = GetGroupMapKeyFromPath(cmtarget, source); cmStdString key = GetGroupMapKeyFromPath(cmtarget, source);
this->GroupMap[key] = pbxgroup; this->GroupMap[key] = pbxgroup;
} }

View File

@ -324,9 +324,9 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
{ {
// Add the file to the list of sources. // Add the file to the list of sources.
std::string source = (*i)->GetFullPath(); std::string source = (*i)->GetFullPath();
cmSourceGroup& sourceGroup = cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
sourceGroup.AssignSource(*i); sourceGroup->AssignSource(*i);
// while we are at it, if it is a .rule file then for visual studio 6 we // while we are at it, if it is a .rule file then for visual studio 6 we
// must generate it // must generate it
if ((*i)->GetPropertyAsBool("__CMAKE_RULE")) if ((*i)->GetPropertyAsBool("__CMAKE_RULE"))

View File

@ -1392,9 +1392,9 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
{ {
this->ModuleDefinitionFile = (*i)->GetFullPath(); this->ModuleDefinitionFile = (*i)->GetFullPath();
} }
cmSourceGroup& sourceGroup = cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
sourceGroup.AssignSource(*i); sourceGroup->AssignSource(*i);
} }
// open the project // open the project

View File

@ -169,17 +169,17 @@ void cmMakefile::Initialize()
this->CheckCMP0000 = false; this->CheckCMP0000 = false;
} }
unsigned int cmMakefile::GetCacheMajorVersion() unsigned int cmMakefile::GetCacheMajorVersion() const
{ {
return this->GetCacheManager()->GetCacheMajorVersion(); return this->GetCacheManager()->GetCacheMajorVersion();
} }
unsigned int cmMakefile::GetCacheMinorVersion() unsigned int cmMakefile::GetCacheMinorVersion() const
{ {
return this->GetCacheManager()->GetCacheMinorVersion(); return this->GetCacheManager()->GetCacheMinorVersion();
} }
bool cmMakefile::NeedCacheCompatibility(int major, int minor) bool cmMakefile::NeedCacheCompatibility(int major, int minor) const
{ {
return this->GetCacheManager()->NeedCacheCompatibility(major, minor); return this->GetCacheManager()->NeedCacheCompatibility(major, minor);
} }
@ -260,7 +260,7 @@ void cmMakefile
// call print on all the classes in the makefile // call print on all the classes in the makefile
void cmMakefile::Print() void cmMakefile::Print() const
{ {
// print the class lists // print the class lists
std::cout << "classes:\n"; std::cout << "classes:\n";
@ -359,7 +359,7 @@ bool cmMakefile::GetBacktrace(cmListFileBacktrace& backtrace) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
{ {
cmOStringStream msg; cmOStringStream msg;
msg << lff.FilePath << "(" << lff.Line << "): "; msg << lff.FilePath << "(" << lff.Line << "): ";
@ -734,7 +734,7 @@ bool cmMakefile::ReadListFile(const char* filename_in,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmMakefile::EnforceDirectoryLevelRules() void cmMakefile::EnforceDirectoryLevelRules() const
{ {
// Diagnose a violation of CMP0000 if necessary. // Diagnose a violation of CMP0000 if necessary.
if(this->CheckCMP0000) if(this->CheckCMP0000)
@ -884,7 +884,7 @@ cmMakefile::AddCustomCommandToTarget(const char* target,
cmTarget::CustomCommandType type, cmTarget::CustomCommandType type,
const char* comment, const char* comment,
const char* workingDir, const char* workingDir,
bool escapeOldStyle) bool escapeOldStyle) const
{ {
// Find the target to which to add the custom command. // Find the target to which to add the custom command.
cmTargets::iterator ti = this->Targets.find(target); cmTargets::iterator ti = this->Targets.find(target);
@ -2058,7 +2058,8 @@ cmMakefile::AddNewTarget(cmTarget::TargetType type, const char* name)
return &it->second; return &it->second;
} }
cmSourceFile *cmMakefile::LinearGetSourceFileWithOutput(const char *cname) cmSourceFile*
cmMakefile::LinearGetSourceFileWithOutput(const char *cname) const
{ {
std::string name = cname; std::string name = cname;
std::string out; std::string out;
@ -2094,7 +2095,7 @@ cmSourceFile *cmMakefile::LinearGetSourceFileWithOutput(const char *cname)
return 0; return 0;
} }
cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname) cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname) const
{ {
std::string name = cname; std::string name = cname;
@ -2105,7 +2106,7 @@ cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname)
return LinearGetSourceFileWithOutput(cname); return LinearGetSourceFileWithOutput(cname);
} }
// Otherwise we use an efficient lookup map. // Otherwise we use an efficient lookup map.
OutputToSourceMap::iterator o = this->OutputToSource.find(name); OutputToSourceMap::const_iterator o = this->OutputToSource.find(name);
if (o != this->OutputToSource.end()) if (o != this->OutputToSource.end())
{ {
return (*o).second; return (*o).second;
@ -2114,19 +2115,20 @@ cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname)
} }
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
cmSourceGroup* cmMakefile::GetSourceGroup(const std::vector<std::string>&name) cmSourceGroup*
cmMakefile::GetSourceGroup(const std::vector<std::string>&name) const
{ {
cmSourceGroup* sg = 0; cmSourceGroup* sg = 0;
// first look for source group starting with the same as the one we wants // first look for source group starting with the same as the one we wants
for (std::vector<cmSourceGroup>::iterator sgIt = this->SourceGroups.begin(); for (std::vector<cmSourceGroup>::const_iterator
sgIt = this->SourceGroups.begin();
sgIt != this->SourceGroups.end(); ++sgIt) sgIt != this->SourceGroups.end(); ++sgIt)
{ {
std::string sgName = sgIt->GetName(); std::string sgName = sgIt->GetName();
if(sgName == name[0]) if(sgName == name[0])
{ {
sg = &(*sgIt); sg = const_cast<cmSourceGroup*>(&(*sgIt));
break; break;
} }
} }
@ -2136,7 +2138,7 @@ cmSourceGroup* cmMakefile::GetSourceGroup(const std::vector<std::string>&name)
// iterate through its children to find match source group // iterate through its children to find match source group
for(unsigned int i=1; i<name.size(); ++i) for(unsigned int i=1; i<name.size(); ++i)
{ {
sg = sg->lookupChild(name[i].c_str()); sg = sg->LookupChild(name[i].c_str());
if(sg == 0) if(sg == 0)
{ {
break; break;
@ -2207,7 +2209,7 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
for(++i; i<=lastElement; ++i) for(++i; i<=lastElement; ++i)
{ {
sg->AddChild(cmSourceGroup(name[i].c_str(), 0, sg->GetFullName())); sg->AddChild(cmSourceGroup(name[i].c_str(), 0, sg->GetFullName()));
sg = sg->lookupChild(name[i].c_str()); sg = sg->LookupChild(name[i].c_str());
fullname = sg->GetFullName(); fullname = sg->GetFullName();
if(strlen(fullname)) if(strlen(fullname))
{ {
@ -2375,7 +2377,7 @@ const char* cmMakefile::GetSONameFlag(const char* language) const
return GetDefinition(name.c_str()); return GetDefinition(name.c_str());
} }
bool cmMakefile::CanIWriteThisFile(const char* fileName) bool cmMakefile::CanIWriteThisFile(const char* fileName) const
{ {
if ( !this->IsOn("CMAKE_DISABLE_SOURCE_CHANGES") ) if ( !this->IsOn("CMAKE_DISABLE_SOURCE_CHANGES") )
{ {
@ -2517,7 +2519,7 @@ std::vector<std::string> cmMakefile
} }
const char *cmMakefile::ExpandVariablesInString(std::string& source) const char *cmMakefile::ExpandVariablesInString(std::string& source) const
{ {
return this->ExpandVariablesInString(source, false, false); return this->ExpandVariablesInString(source, false, false);
} }
@ -2529,7 +2531,7 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source,
const char* filename, const char* filename,
long line, long line,
bool removeEmpty, bool removeEmpty,
bool replaceAt) bool replaceAt) const
{ {
if ( source.empty() || source.find_first_of("$@\\") == source.npos) if ( source.empty() || source.find_first_of("$@\\") == source.npos)
{ {
@ -2773,9 +2775,9 @@ cmMakefile::GetConfigurations(std::vector<std::string>& configs,
* non-inherited SOURCE_GROUP commands will have precedence over * non-inherited SOURCE_GROUP commands will have precedence over
* inherited ones. * inherited ones.
*/ */
cmSourceGroup& cmSourceGroup*
cmMakefile::FindSourceGroup(const char* source, cmMakefile::FindSourceGroup(const char* source,
std::vector<cmSourceGroup> &groups) std::vector<cmSourceGroup> &groups) const
{ {
// First search for a group that lists the file explicitly. // First search for a group that lists the file explicitly.
for(std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin(); for(std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin();
@ -2784,7 +2786,7 @@ cmMakefile::FindSourceGroup(const char* source,
cmSourceGroup *result = sg->MatchChildrenFiles(source); cmSourceGroup *result = sg->MatchChildrenFiles(source);
if(result) if(result)
{ {
return *result; return result;
} }
} }
@ -2795,13 +2797,13 @@ cmMakefile::FindSourceGroup(const char* source,
cmSourceGroup *result = sg->MatchChildrenRegex(source); cmSourceGroup *result = sg->MatchChildrenRegex(source);
if(result) if(result)
{ {
return *result; return result;
} }
} }
// Shouldn't get here, but just in case, return the default group. // Shouldn't get here, but just in case, return the default group.
return groups.front(); return &groups.front();
} }
#endif #endif
@ -2864,7 +2866,7 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError)
bool cmMakefile::ExpandArguments( bool cmMakefile::ExpandArguments(
std::vector<cmListFileArgument> const& inArgs, std::vector<cmListFileArgument> const& inArgs,
std::vector<std::string>& outArgs) std::vector<std::string>& outArgs) const
{ {
std::vector<cmListFileArgument>::const_iterator i; std::vector<cmListFileArgument>::const_iterator i;
std::string value; std::string value;
@ -3008,7 +3010,7 @@ void cmMakefile::SetArgcArgv(const std::vector<std::string>& args)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmSourceFile* cmMakefile::GetSource(const char* sourceName) cmSourceFile* cmMakefile::GetSource(const char* sourceName) const
{ {
cmSourceFileLocation sfl(this, sourceName); cmSourceFileLocation sfl(this, sourceName);
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
@ -3056,7 +3058,7 @@ void cmMakefile::EnableLanguage(std::vector<std::string> const & lang,
void cmMakefile::ExpandSourceListArguments( void cmMakefile::ExpandSourceListArguments(
std::vector<std::string> const& arguments, std::vector<std::string> const& arguments,
std::vector<std::string>& newargs, unsigned int /* start */) std::vector<std::string>& newargs, unsigned int /* start */) const
{ {
// now expand the args // now expand the args
unsigned int i; unsigned int i;
@ -3235,9 +3237,9 @@ void cmMakefile::AddMacro(const char* name, const char* signature)
this->MacrosMap[name] = signature; this->MacrosMap[name] = signature;
} }
void cmMakefile::GetListOfMacros(std::string& macros) void cmMakefile::GetListOfMacros(std::string& macros) const
{ {
StringStringMap::iterator it; StringStringMap::const_iterator it;
macros = ""; macros = "";
int cc = 0; int cc = 0;
for ( it = this->MacrosMap.begin(); it != this->MacrosMap.end(); ++it ) for ( it = this->MacrosMap.begin(); it != this->MacrosMap.end(); ++it )
@ -3256,7 +3258,7 @@ cmCacheManager *cmMakefile::GetCacheManager() const
return this->GetCMakeInstance()->GetCacheManager(); return this->GetCMakeInstance()->GetCacheManager();
} }
void cmMakefile::DisplayStatus(const char* message, float s) void cmMakefile::DisplayStatus(const char* message, float s) const
{ {
cmake* cm = this->GetLocalGenerator()->GetGlobalGenerator() cmake* cm = this->GetLocalGenerator()->GetGlobalGenerator()
->GetCMakeInstance(); ->GetCMakeInstance();
@ -3269,7 +3271,7 @@ void cmMakefile::DisplayStatus(const char* message, float s)
cm->UpdateProgress(message, s); cm->UpdateProgress(message, s);
} }
std::string cmMakefile::GetModulesFile(const char* filename) std::string cmMakefile::GetModulesFile(const char* filename) const
{ {
std::string result; std::string result;
@ -3369,7 +3371,7 @@ std::string cmMakefile::GetModulesFile(const char* filename)
void cmMakefile::ConfigureString(const std::string& input, void cmMakefile::ConfigureString(const std::string& input,
std::string& output, bool atOnly, std::string& output, bool atOnly,
bool escapeQuotes) bool escapeQuotes) const
{ {
// Split input to handle one line at a time. // Split input to handle one line at a time.
std::string::const_iterator lineStart = input.begin(); std::string::const_iterator lineStart = input.begin();
@ -3673,7 +3675,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString); this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString);
} }
const char *cmMakefile::GetPropertyOrDefinition(const char* prop) const char *cmMakefile::GetPropertyOrDefinition(const char* prop) const
{ {
const char *ret = this->GetProperty(prop, cmProperty::DIRECTORY); const char *ret = this->GetProperty(prop, cmProperty::DIRECTORY);
if (!ret) if (!ret)
@ -3683,13 +3685,13 @@ const char *cmMakefile::GetPropertyOrDefinition(const char* prop)
return ret; return ret;
} }
const char *cmMakefile::GetProperty(const char* prop) const char *cmMakefile::GetProperty(const char* prop) const
{ {
return this->GetProperty(prop, cmProperty::DIRECTORY); return this->GetProperty(prop, cmProperty::DIRECTORY);
} }
const char *cmMakefile::GetProperty(const char* prop, const char *cmMakefile::GetProperty(const char* prop,
cmProperty::ScopeType scope) cmProperty::ScopeType scope) const
{ {
if(!prop) if(!prop)
{ {
@ -3713,7 +3715,8 @@ const char *cmMakefile::GetProperty(const char* prop,
} }
else if (!strcmp("LISTFILE_STACK",prop)) else if (!strcmp("LISTFILE_STACK",prop))
{ {
for (std::deque<cmStdString>::iterator i = this->ListFileStack.begin(); for (std::deque<cmStdString>::const_iterator
i = this->ListFileStack.begin();
i != this->ListFileStack.end(); ++i) i != this->ListFileStack.end(); ++i)
{ {
if (i != this->ListFileStack.begin()) if (i != this->ListFileStack.begin())
@ -3828,7 +3831,7 @@ const char *cmMakefile::GetProperty(const char* prop,
return retVal; return retVal;
} }
bool cmMakefile::GetPropertyAsBool(const char* prop) bool cmMakefile::GetPropertyAsBool(const char* prop) const
{ {
return cmSystemTools::IsOn(this->GetProperty(prop)); return cmSystemTools::IsOn(this->GetProperty(prop));
} }
@ -3937,13 +3940,13 @@ void cmMakefile::AddCMakeDependFilesFromUser()
} }
} }
std::string cmMakefile::GetListFileStack() std::string cmMakefile::GetListFileStack() const
{ {
cmOStringStream tmp; cmOStringStream tmp;
size_t depth = this->ListFileStack.size(); size_t depth = this->ListFileStack.size();
if (depth > 0) if (depth > 0)
{ {
std::deque<cmStdString>::iterator it = this->ListFileStack.end(); std::deque<cmStdString>::const_iterator it = this->ListFileStack.end();
do do
{ {
if (depth != this->ListFileStack.size()) if (depth != this->ListFileStack.size())
@ -4089,7 +4092,7 @@ cmMakefile::AddImportedTarget(const char* name, cmTarget::TargetType type,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmTarget* cmMakefile::FindTargetToUse(const std::string& name, cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
bool excludeAliases) bool excludeAliases) const
{ {
// Look for an imported target. These take priority because they // Look for an imported target. These take priority because they
// are more local in scope and do not have to be globally unique. // are more local in scope and do not have to be globally unique.
@ -4113,7 +4116,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmMakefile::IsAlias(const std::string& name) bool cmMakefile::IsAlias(const std::string& name) const
{ {
if (this->AliasTargets.find(name) != this->AliasTargets.end()) if (this->AliasTargets.find(name) != this->AliasTargets.end())
return true; return true;
@ -4122,7 +4125,8 @@ bool cmMakefile::IsAlias(const std::string& name)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGeneratorTarget* cmMakefile::FindGeneratorTargetToUse(const char* name) cmGeneratorTarget*
cmMakefile::FindGeneratorTargetToUse(const char* name) const
{ {
if (cmTarget *t = this->FindTargetToUse(name)) if (cmTarget *t = this->FindTargetToUse(name))
{ {
@ -4133,7 +4137,7 @@ cmGeneratorTarget* cmMakefile::FindGeneratorTargetToUse(const char* name)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
bool isCustom) bool isCustom) const
{ {
if(this->IsAlias(name)) if(this->IsAlias(name))
{ {
@ -4224,7 +4228,8 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmMakefile::EnforceUniqueDir(const char* srcPath, const char* binPath) bool cmMakefile::EnforceUniqueDir(const char* srcPath,
const char* binPath) const
{ {
// Make sure the binary directory is unique. // Make sure the binary directory is unique.
cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator();
@ -4285,7 +4290,7 @@ std::vector<cmSourceFile*> cmMakefile::GetQtUiFilesWithOptions() const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmPolicies::PolicyStatus cmPolicies::PolicyStatus
cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const
{ {
// Get the current setting of the policy. // Get the current setting of the policy.
cmPolicies::PolicyStatus cur = this->GetPolicyStatusInternal(id); cmPolicies::PolicyStatus cur = this->GetPolicyStatusInternal(id);
@ -4313,10 +4318,10 @@ cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmPolicies::PolicyStatus cmPolicies::PolicyStatus
cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const
{ {
// Is the policy set in our stack? // Is the policy set in our stack?
for(PolicyStackType::reverse_iterator psi = this->PolicyStack.rbegin(); for(PolicyStackType::const_reverse_iterator psi = this->PolicyStack.rbegin();
psi != this->PolicyStack.rend(); ++psi) psi != this->PolicyStack.rend(); ++psi)
{ {
PolicyStackEntry::const_iterator pse = psi->find(id); PolicyStackEntry::const_iterator pse = psi->find(id);
@ -4466,7 +4471,7 @@ bool cmMakefile::SetPolicyVersion(const char *version)
ApplyPolicyVersion(this,version); ApplyPolicyVersion(this,version);
} }
cmPolicies *cmMakefile::GetPolicies() cmPolicies *cmMakefile::GetPolicies() const
{ {
if (!this->GetCMakeInstance()) if (!this->GetCMakeInstance())
{ {

View File

@ -63,8 +63,8 @@ public:
* was used to write the currently loaded cache, note * was used to write the currently loaded cache, note
* this method will not work before the cache is loaded. * this method will not work before the cache is loaded.
*/ */
unsigned int GetCacheMajorVersion(); unsigned int GetCacheMajorVersion() const;
unsigned int GetCacheMinorVersion(); unsigned int GetCacheMinorVersion() const;
/* Check for unused variables in this scope */ /* Check for unused variables in this scope */
void CheckForUnusedVariables() const; void CheckForUnusedVariables() const;
@ -76,7 +76,7 @@ public:
bool VariableUsed(const char* ) const; bool VariableUsed(const char* ) const;
/** Return whether compatibility features needed for a version of /** Return whether compatibility features needed for a version of
the cache or lower should be enabled. */ the cache or lower should be enabled. */
bool NeedCacheCompatibility(int major, int minor); bool NeedCacheCompatibility(int major, int minor) const;
/** /**
* Construct an empty makefile. * Construct an empty makefile.
@ -142,14 +142,14 @@ public:
void SetLocalGenerator(cmLocalGenerator*); void SetLocalGenerator(cmLocalGenerator*);
///! Get the current makefile generator. ///! Get the current makefile generator.
cmLocalGenerator* GetLocalGenerator() cmLocalGenerator* GetLocalGenerator() const
{ return this->LocalGenerator;} { return this->LocalGenerator;}
/** /**
* Help enforce global target name uniqueness. * Help enforce global target name uniqueness.
*/ */
bool EnforceUniqueName(std::string const& name, std::string& msg, bool EnforceUniqueName(std::string const& name, std::string& msg,
bool isCustom = false); bool isCustom = false) const;
/** /**
* Perform FinalPass, Library dependency analysis etc before output of the * Perform FinalPass, Library dependency analysis etc before output of the
@ -165,7 +165,7 @@ public:
/** /**
* Print the object state to std::cout. * Print the object state to std::cout.
*/ */
void Print(); void Print() const;
/** Add a custom command to the build. */ /** Add a custom command to the build. */
void AddCustomCommandToTarget(const char* target, void AddCustomCommandToTarget(const char* target,
@ -173,7 +173,7 @@ public:
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,
cmTarget::CustomCommandType type, cmTarget::CustomCommandType type,
const char* comment, const char* workingDir, const char* comment, const char* workingDir,
bool escapeOldStyle = true); bool escapeOldStyle = true) const;
cmSourceFile* AddCustomCommandToOutput( cmSourceFile* AddCustomCommandToOutput(
const std::vector<std::string>& outputs, const std::vector<std::string>& outputs,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
@ -250,13 +250,6 @@ public:
*/ */
void AddLinkDirectory(const char*); void AddLinkDirectory(const char*);
/**
* Get the list of link directories
*/
std::vector<std::string>& GetLinkDirectories()
{
return this->LinkDirectories;
}
const std::vector<std::string>& GetLinkDirectories() const const std::vector<std::string>& GetLinkDirectories() const
{ {
return this->LinkDirectories; return this->LinkDirectories;
@ -356,7 +349,7 @@ public:
*/ */
bool SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status); bool SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status);
bool SetPolicy(const char *id, cmPolicies::PolicyStatus status); bool SetPolicy(const char *id, cmPolicies::PolicyStatus status);
cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id) const;
bool SetPolicyVersion(const char *version); bool SetPolicyVersion(const char *version);
void RecordPolicies(cmPolicies::PolicyMap& pm); void RecordPolicies(cmPolicies::PolicyMap& pm);
//@} //@}
@ -379,7 +372,7 @@ public:
/** /**
* Get the Policies Instance * Get the Policies Instance
*/ */
cmPolicies *GetPolicies(); cmPolicies *GetPolicies() const;
/** /**
* Add an auxiliary directory to the build. * Add an auxiliary directory to the build.
@ -492,7 +485,7 @@ public:
{ {
this->IncludeFileRegularExpression = regex; this->IncludeFileRegularExpression = regex;
} }
const char* GetIncludeRegularExpression() const char* GetIncludeRegularExpression() const
{ {
return this->IncludeFileRegularExpression.c_str(); return this->IncludeFileRegularExpression.c_str();
} }
@ -505,7 +498,7 @@ public:
{ {
this->ComplainFileRegularExpression = regex; this->ComplainFileRegularExpression = regex;
} }
const char* GetComplainRegularExpression() const char* GetComplainRegularExpression() const
{ {
return this->ComplainFileRegularExpression.c_str(); return this->ComplainFileRegularExpression.c_str();
} }
@ -539,15 +532,14 @@ public:
/** Find a target to use in place of the given name. The target /** Find a target to use in place of the given name. The target
returned may be imported or built within the project. */ returned may be imported or built within the project. */
cmTarget* FindTargetToUse(const std::string& name, cmTarget* FindTargetToUse(const std::string& name,
bool excludeAliases = false); bool excludeAliases = false) const;
bool IsAlias(const std::string& name); bool IsAlias(const std::string& name) const;
cmGeneratorTarget* FindGeneratorTargetToUse(const char* name); cmGeneratorTarget* FindGeneratorTargetToUse(const char* name) const;
/** /**
* Mark include directories as system directories. * Mark include directories as system directories.
*/ */
void AddSystemIncludeDirectories(const std::set<cmStdString> &incs); void AddSystemIncludeDirectories(const std::set<cmStdString> &incs);
bool IsSystemIncludeDirectory(const char* dir, const char *config);
/** Expand out any arguements in the vector that have ; separated /** Expand out any arguements in the vector that have ; separated
* strings into multiple arguements. A new vector is created * strings into multiple arguements. A new vector is created
@ -558,12 +550,12 @@ public:
*/ */
void ExpandSourceListArguments(std::vector<std::string> const& argsIn, void ExpandSourceListArguments(std::vector<std::string> const& argsIn,
std::vector<std::string>& argsOut, std::vector<std::string>& argsOut,
unsigned int startArgumentIndex); unsigned int startArgumentIndex) const;
/** Get a cmSourceFile pointer for a given source name, if the name is /** Get a cmSourceFile pointer for a given source name, if the name is
* not found, then a null pointer is returned. * not found, then a null pointer is returned.
*/ */
cmSourceFile* GetSource(const char* sourceName); cmSourceFile* GetSource(const char* sourceName) const;
/** Get a cmSourceFile pointer for a given source name, if the name is /** Get a cmSourceFile pointer for a given source name, if the name is
* not found, then create the source file and return it. generated * not found, then create the source file and return it. generated
@ -576,7 +568,7 @@ public:
/** /**
* Obtain a list of auxiliary source directories. * Obtain a list of auxiliary source directories.
*/ */
std::vector<std::string>& GetAuxSourceDirectories() const std::vector<std::string>& GetAuxSourceDirectories() const
{return this->AuxSourceDirectories;} {return this->AuxSourceDirectories;}
//@{ //@{
@ -621,13 +613,13 @@ public:
/** /**
* Get a list of preprocessor define flags. * Get a list of preprocessor define flags.
*/ */
const char* GetDefineFlags() const char* GetDefineFlags() const
{return this->DefineFlags.c_str();} {return this->DefineFlags.c_str();}
/** /**
* Make sure CMake can write this file * Make sure CMake can write this file
*/ */
bool CanIWriteThisFile(const char* fileName); bool CanIWriteThisFile(const char* fileName) const;
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
/** /**
@ -639,7 +631,7 @@ public:
/** /**
* Get the source group * Get the source group
*/ */
cmSourceGroup* GetSourceGroup(const std::vector<std::string>&name); cmSourceGroup* GetSourceGroup(const std::vector<std::string>&name) const;
#endif #endif
/** /**
@ -652,10 +644,7 @@ public:
{ this->ListFiles.push_back(file);} { this->ListFiles.push_back(file);}
void AddCMakeDependFilesFromUser(); void AddCMakeDependFilesFromUser();
/** std::string GetListFileStack() const;
* Get the list file stack as a string
*/
std::string GetListFileStack();
/** /**
* Get the current context backtrace. * Get the current context backtrace.
@ -677,14 +666,14 @@ public:
* entry in the this->Definitions map. Also \@var\@ is * entry in the this->Definitions map. Also \@var\@ is
* expanded to match autoconf style expansions. * expanded to match autoconf style expansions.
*/ */
const char *ExpandVariablesInString(std::string& source); const char *ExpandVariablesInString(std::string& source) const;
const char *ExpandVariablesInString(std::string& source, bool escapeQuotes, const char *ExpandVariablesInString(std::string& source, bool escapeQuotes,
bool noEscapes, bool noEscapes,
bool atOnly = false, bool atOnly = false,
const char* filename = 0, const char* filename = 0,
long line = -1, long line = -1,
bool removeEmpty = false, bool removeEmpty = false,
bool replaceAt = true); bool replaceAt = true) const;
/** /**
* Remove any remaining variables in the string. Anything with ${var} or * Remove any remaining variables in the string. Anything with ${var} or
@ -703,7 +692,7 @@ public:
* See cmConfigureFileCommand for details. * See cmConfigureFileCommand for details.
*/ */
void ConfigureString(const std::string& input, std::string& output, void ConfigureString(const std::string& input, std::string& output,
bool atOnly, bool escapeQuotes); bool atOnly, bool escapeQuotes) const;
/** /**
* Copy file but change lines acording to ConfigureString * Copy file but change lines acording to ConfigureString
@ -717,14 +706,14 @@ public:
/** /**
* find what source group this source is in * find what source group this source is in
*/ */
cmSourceGroup& FindSourceGroup(const char* source, cmSourceGroup* FindSourceGroup(const char* source,
std::vector<cmSourceGroup> &groups); std::vector<cmSourceGroup> &groups) const;
#endif #endif
/** /**
* Print a command's invocation * Print a command's invocation
*/ */
void PrintCommandTrace(const cmListFileFunction& lff); void PrintCommandTrace(const cmListFileFunction& lff) const;
/** /**
* Execute a single CMake command. Returns true if the command * Execute a single CMake command. Returns true if the command
@ -760,14 +749,14 @@ public:
#endif #endif
///! Display progress or status message. ///! Display progress or status message.
void DisplayStatus(const char*, float); void DisplayStatus(const char*, float) const;
/** /**
* Expand the given list file arguments into the full set after * Expand the given list file arguments into the full set after
* variable replacement and list expansion. * variable replacement and list expansion.
*/ */
bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs, bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
std::vector<std::string>& outArgs); std::vector<std::string>& outArgs) const;
/** /**
* Get the instance * Get the instance
*/ */
@ -784,7 +773,7 @@ public:
* Is there a source file that has the provided source file as an output? * Is there a source file that has the provided source file as an output?
* if so then return it * if so then return it
*/ */
cmSourceFile *GetSourceFileWithOutput(const char *outName); cmSourceFile *GetSourceFileWithOutput(const char *outName) const;
/** /**
* Add a macro to the list of macros. The arguments should be name of the * Add a macro to the list of macros. The arguments should be name of the
@ -803,20 +792,20 @@ public:
/** /**
* Get a list of macros as a ; separated string * Get a list of macros as a ; separated string
*/ */
void GetListOfMacros(std::string& macros); void GetListOfMacros(std::string& macros) const;
/** /**
* Return a location of a file in cmake or custom modules directory * Return a location of a file in cmake or custom modules directory
*/ */
std::string GetModulesFile(const char* name); std::string GetModulesFile(const char* name) const;
///! Set/Get a property of this directory ///! Set/Get a property of this directory
void SetProperty(const char *prop, const char *value); void SetProperty(const char *prop, const char *value);
void AppendProperty(const char *prop, const char *value,bool asString=false); void AppendProperty(const char *prop, const char *value,bool asString=false);
const char *GetProperty(const char *prop); const char *GetProperty(const char *prop) const;
const char *GetPropertyOrDefinition(const char *prop); const char *GetPropertyOrDefinition(const char *prop) const;
const char *GetProperty(const char *prop, cmProperty::ScopeType scope); const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const;
bool GetPropertyAsBool(const char *prop); bool GetPropertyAsBool(const char *prop) const;
const char* GetFeature(const char* feature, const char* config); const char* GetFeature(const char* feature, const char* config);
@ -837,7 +826,7 @@ public:
void AddTestGenerator(cmTestGenerator* g) void AddTestGenerator(cmTestGenerator* g)
{ if(g) this->TestGenerators.push_back(g); } { if(g) this->TestGenerators.push_back(g); }
std::vector<cmTestGenerator*>& GetTestGenerators() const std::vector<cmTestGenerator*>& GetTestGenerators() const
{ return this->TestGenerators; } { return this->TestGenerators; }
// Define the properties // Define the properties
@ -877,7 +866,7 @@ public:
return this->CompileDefinitionsEntries; return this->CompileDefinitionsEntries;
} }
bool IsGeneratingBuildSystem(){ return this->GeneratingBuildSystem; } bool IsGeneratingBuildSystem() const { return this->GeneratingBuildSystem; }
void SetGeneratingBuildSystem(){ this->GeneratingBuildSystem = true; } void SetGeneratingBuildSystem(){ this->GeneratingBuildSystem = true; }
void AddQtUiFileWithOptions(cmSourceFile *sf); void AddQtUiFileWithOptions(cmSourceFile *sf);
@ -958,7 +947,7 @@ private:
bool ParseDefineFlag(std::string const& definition, bool remove); bool ParseDefineFlag(std::string const& definition, bool remove);
bool EnforceUniqueDir(const char* srcPath, const char* binPath); bool EnforceUniqueDir(const char* srcPath, const char* binPath) const;
friend class cmMakeDepend; // make depend needs direct access friend class cmMakeDepend; // make depend needs direct access
// to the Sources array // to the Sources array
@ -979,9 +968,9 @@ private:
std::map<cmStdString, bool> SubDirectoryOrder; std::map<cmStdString, bool> SubDirectoryOrder;
cmsys::RegularExpression cmDefineRegex; mutable cmsys::RegularExpression cmDefineRegex;
cmsys::RegularExpression cmDefine01Regex; mutable cmsys::RegularExpression cmDefine01Regex;
cmsys::RegularExpression cmAtVarRegex; mutable cmsys::RegularExpression cmAtVarRegex;
cmPropertyMap Properties; cmPropertyMap Properties;
@ -1005,7 +994,6 @@ private:
CallStackType CallStack; CallStackType CallStack;
friend class cmMakefileCall; friend class cmMakefileCall;
cmTarget* FindBasicTarget(const char* name);
std::vector<cmTarget*> ImportedTargetsOwned; std::vector<cmTarget*> ImportedTargetsOwned;
std::map<cmStdString, cmTarget*> ImportedTargets; std::map<cmStdString, cmTarget*> ImportedTargets;
@ -1031,12 +1019,13 @@ private:
typedef std::vector<PolicyStackEntry> PolicyStackType; typedef std::vector<PolicyStackEntry> PolicyStackType;
PolicyStackType PolicyStack; PolicyStackType PolicyStack;
std::vector<PolicyStackType::size_type> PolicyBarriers; std::vector<PolicyStackType::size_type> PolicyBarriers;
cmPolicies::PolicyStatus GetPolicyStatusInternal(cmPolicies::PolicyID id); cmPolicies::PolicyStatus
GetPolicyStatusInternal(cmPolicies::PolicyID id) const;
bool CheckCMP0000; bool CheckCMP0000;
// Enforce rules about CMakeLists.txt files. // Enforce rules about CMakeLists.txt files.
void EnforceDirectoryLevelRules(); void EnforceDirectoryLevelRules() const;
bool GeneratingBuildSystem; bool GeneratingBuildSystem;
/** /**
@ -1045,7 +1034,7 @@ private:
* relative file paths. It is used as a fall back by * relative file paths. It is used as a fall back by
* GetSourceFileWithOutput(const char*). * GetSourceFileWithOutput(const char*).
*/ */
cmSourceFile *LinearGetSourceFileWithOutput(const char *cname); cmSourceFile *LinearGetSourceFileWithOutput(const char *cname) const;
// A map for fast output to input look up. // A map for fast output to input look up.
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)

View File

@ -142,7 +142,7 @@ bool cmSourceFile::FindFullPath(std::string* error)
} }
// The file is not generated. It must exist on disk. // The file is not generated. It must exist on disk.
cmMakefile* mf = this->Location.GetMakefile(); cmMakefile const* mf = this->Location.GetMakefile();
const char* tryDirs[3] = {0, 0, 0}; const char* tryDirs[3] = {0, 0, 0};
if(this->Location.DirectoryIsAmbiguous()) if(this->Location.DirectoryIsAmbiguous())
{ {
@ -264,7 +264,7 @@ void cmSourceFile::CheckExtension()
void cmSourceFile::CheckLanguage(std::string const& ext) void cmSourceFile::CheckLanguage(std::string const& ext)
{ {
// Try to identify the source file language from the extension. // Try to identify the source file language from the extension.
cmMakefile* mf = this->Location.GetMakefile(); cmMakefile const* mf = this->Location.GetMakefile();
cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator(); cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator();
if(const char* l = gg->GetLanguageFromExtension(ext.c_str())) if(const char* l = gg->GetLanguageFromExtension(ext.c_str()))
{ {
@ -292,10 +292,10 @@ void cmSourceFile::SetProperty(const char* prop, const char* value)
cmSystemTools::GetFilenameLastExtension(this->Location.GetName()); cmSystemTools::GetFilenameLastExtension(this->Location.GetName());
if (ext == ".ui") if (ext == ".ui")
{ {
cmMakefile* mf = this->Location.GetMakefile(); cmMakefile const* mf = this->Location.GetMakefile();
if (strcmp(prop, "AUTOUIC_OPTIONS") == 0) if (strcmp(prop, "AUTOUIC_OPTIONS") == 0)
{ {
mf->AddQtUiFileWithOptions(this); const_cast<cmMakefile*>(mf)->AddQtUiFileWithOptions(this);
} }
} }
} }
@ -360,7 +360,7 @@ const char* cmSourceFile::GetProperty(const char* prop) const
this->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, chain); this->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, chain);
if (chain) if (chain)
{ {
cmMakefile* mf = this->Location.GetMakefile(); cmMakefile const* mf = this->Location.GetMakefile();
return mf->GetProperty(prop,cmProperty::SOURCE_FILE); return mf->GetProperty(prop,cmProperty::SOURCE_FILE);
} }

View File

@ -18,7 +18,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmSourceFileLocation cmSourceFileLocation
::cmSourceFileLocation(cmMakefile* mf, const char* name): Makefile(mf) ::cmSourceFileLocation(cmMakefile const* mf, const char* name): Makefile(mf)
{ {
this->AmbiguousDirectory = !cmSystemTools::FileIsFullPath(name); this->AmbiguousDirectory = !cmSystemTools::FileIsFullPath(name);
this->AmbiguousExtension = true; this->AmbiguousExtension = true;
@ -89,7 +89,7 @@ void cmSourceFileLocation::UpdateExtension(const char* name)
// The global generator checks extensions of enabled languages. // The global generator checks extensions of enabled languages.
cmGlobalGenerator* gg = cmGlobalGenerator* gg =
this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); this->Makefile->GetLocalGenerator()->GetGlobalGenerator();
cmMakefile* mf = this->Makefile; cmMakefile const* mf = this->Makefile;
const std::vector<std::string>& srcExts = mf->GetSourceExtensions(); const std::vector<std::string>& srcExts = mf->GetSourceExtensions();
const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions(); const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions();
if(gg->GetLanguageFromExtension(ext.c_str()) || if(gg->GetLanguageFromExtension(ext.c_str()) ||
@ -170,7 +170,7 @@ cmSourceFileLocation
// Only a fixed set of extensions will be tried to match a file on // Only a fixed set of extensions will be tried to match a file on
// disk. One of these must match if loc refers to this source file. // disk. One of these must match if loc refers to this source file.
std::string ext = this->Name.substr(loc.Name.size()+1); std::string ext = this->Name.substr(loc.Name.size()+1);
cmMakefile* mf = this->Makefile; cmMakefile const* mf = this->Makefile;
const std::vector<std::string>& srcExts = mf->GetSourceExtensions(); const std::vector<std::string>& srcExts = mf->GetSourceExtensions();
if(std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end()) if(std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end())
{ {

View File

@ -33,7 +33,7 @@ public:
* Construct for a source file created in a given cmMakefile * Construct for a source file created in a given cmMakefile
* instance with an initial name. * instance with an initial name.
*/ */
cmSourceFileLocation(cmMakefile* mf, const char* name); cmSourceFileLocation(cmMakefile const* mf, const char* name);
/** /**
* Return whether the givne source file location could refers to the * Return whether the givne source file location could refers to the
@ -81,9 +81,9 @@ public:
/** /**
* Get the cmMakefile instance for which the source file was created. * Get the cmMakefile instance for which the source file was created.
*/ */
cmMakefile* GetMakefile() const { return this->Makefile; } cmMakefile const* GetMakefile() const { return this->Makefile; }
private: private:
cmMakefile* Makefile; cmMakefile const* Makefile;
bool AmbiguousDirectory; bool AmbiguousDirectory;
bool AmbiguousExtension; bool AmbiguousExtension;
std::string Directory; std::string Directory;

View File

@ -126,12 +126,12 @@ void cmSourceGroup::AddChild(cmSourceGroup child)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmSourceGroup *cmSourceGroup::lookupChild(const char* name) cmSourceGroup *cmSourceGroup::LookupChild(const char* name) const
{ {
// initializing iterators // initializing iterators
std::vector<cmSourceGroup>::iterator iter = std::vector<cmSourceGroup>::const_iterator iter =
this->Internal->GroupChildren.begin(); this->Internal->GroupChildren.begin();
std::vector<cmSourceGroup>::iterator end = const std::vector<cmSourceGroup>::const_iterator end =
this->Internal->GroupChildren.end(); this->Internal->GroupChildren.end();
// st // st
@ -142,7 +142,7 @@ cmSourceGroup *cmSourceGroup::lookupChild(const char* name)
// look if descenened is the one were looking for // look if descenened is the one were looking for
if(sgName == name) if(sgName == name)
{ {
return &(*iter); // if it so return it return const_cast<cmSourceGroup*>(&(*iter)); // if it so return it
} }
} }

View File

@ -56,7 +56,7 @@ public:
/** /**
* Looks up child and returns it * Looks up child and returns it
*/ */
cmSourceGroup *lookupChild(const char *name); cmSourceGroup *LookupChild(const char *name) const;
/** /**
* Get the name of this group. * Get the name of this group.

View File

@ -708,9 +708,9 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
{ {
cmSourceFile* sf = *s; cmSourceFile* sf = *s;
std::string const& source = sf->GetFullPath(); std::string const& source = sf->GetFullPath();
cmSourceGroup& sourceGroup = cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
groupsUsed.insert(&sourceGroup); groupsUsed.insert(sourceGroup);
} }
this->AddMissingSourceGroups(groupsUsed, sourceGroups); this->AddMissingSourceGroups(groupsUsed, sourceGroups);
@ -901,9 +901,9 @@ WriteGroupSources(const char* name,
{ {
cmSourceFile* sf = s->SourceFile; cmSourceFile* sf = s->SourceFile;
std::string const& source = sf->GetFullPath(); std::string const& source = sf->GetFullPath();
cmSourceGroup& sourceGroup = cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
const char* filter = sourceGroup.GetFullName(); const char* filter = sourceGroup->GetFullName();
this->WriteString("<", 2); this->WriteString("<", 2);
std::string path = this->ConvertPath(source, s->RelativePath); std::string path = this->ConvertPath(source, s->RelativePath);
this->ConvertToWindowsSlash(path); this->ConvertToWindowsSlash(path);