Merge topic 'clean-up-cmLocalGenerator'

e54d2fdf Convert: Remove specification of default parameter.
20c2fe4d cmLocalGenerator: Get enabled languages from cmState.
7601a7b1 cmLocalGenerator: Implement IsRootMakefile in terms of cmState.
4080ca49 cmLocalGenerator: Inline ReadListFile method.
ad706819 cmLocalGenerator: Devirtualize method.
This commit is contained in:
Brad King 2015-05-21 09:03:54 -04:00 committed by CMake Topic Stage
commit db90e7c6bc
5 changed files with 13 additions and 26 deletions

View File

@ -76,7 +76,7 @@ cmLocalGenerator::~cmLocalGenerator()
bool cmLocalGenerator::IsRootMakefile() const bool cmLocalGenerator::IsRootMakefile() const
{ {
return !this->GetParent(); return !this->StateSnapshot.GetParent().IsValid();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -115,8 +115,10 @@ void cmLocalGenerator::Configure()
filesDir += cmake::GetCMakeFilesDirectory(); filesDir += cmake::GetCMakeFilesDirectory();
cmSystemTools::MakeDirectory(filesDir.c_str()); cmSystemTools::MakeDirectory(filesDir.c_str());
// find & read the list file std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory();
this->ReadInputFile(); currentStart += "/CMakeLists.txt";
assert(cmSystemTools::FileExists(currentStart.c_str(), true));
this->Makefile->ProcessBuildsystemFile(currentStart.c_str());
// at the end of the ReadListFile handle any old style subdirs // at the end of the ReadListFile handle any old style subdirs
// first get all the subdirectories // first get all the subdirectories
@ -183,16 +185,6 @@ void cmLocalGenerator::ComputeObjectMaxPath()
this->ObjectMaxPathViolations.clear(); this->ObjectMaxPathViolations.clear();
} }
//----------------------------------------------------------------------------
void cmLocalGenerator::ReadInputFile()
{
// Look for the CMakeLists.txt file.
std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory();
currentStart += "/CMakeLists.txt";
assert(cmSystemTools::FileExists(currentStart.c_str(), true));
this->Makefile->ProcessBuildsystemFile(currentStart.c_str());
}
void cmLocalGenerator::ConfigureFinalPass() void cmLocalGenerator::ConfigureFinalPass()
{ {
this->Makefile->ConfigureFinalPass(); this->Makefile->ConfigureFinalPass();
@ -1003,8 +995,8 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
{ {
return this->Convert(cmSystemTools::GetCMakeCommand(), FULL, SHELL); return this->Convert(cmSystemTools::GetCMakeCommand(), FULL, SHELL);
} }
std::vector<std::string> enabledLanguages; std::vector<std::string> enabledLanguages =
this->GlobalGenerator->GetEnabledLanguages(enabledLanguages); this->GetState()->GetEnabledLanguages();
// loop over language specific replace variables // loop over language specific replace variables
int pos = 0; int pos = 0;
while(ruleReplaceVars[pos]) while(ruleReplaceVars[pos])
@ -1846,7 +1838,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
fdi != fwDirs.end(); ++fdi) fdi != fwDirs.end(); ++fdi)
{ {
frameworkPath += fwSearchFlag; frameworkPath += fwSearchFlag;
frameworkPath += this->Convert(*fdi, NONE, shellFormat, false); frameworkPath += this->Convert(*fdi, NONE, shellFormat);
frameworkPath += " "; frameworkPath += " ";
} }
} }
@ -1900,7 +1892,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
ri != runtimeDirs.end(); ++ri) ri != runtimeDirs.end(); ++ri)
{ {
rpath += cli.GetRuntimeFlag(); rpath += cli.GetRuntimeFlag();
rpath += this->Convert(*ri, NONE, shellFormat, false); rpath += this->Convert(*ri, NONE, shellFormat);
rpath += " "; rpath += " ";
} }
fout << rpath; fout << rpath;

View File

@ -395,7 +395,7 @@ public:
protected: protected:
///! put all the libraries for a target on into the given stream ///! put all the libraries for a target on into the given stream
virtual void OutputLinkLibraries(std::string& linkLibraries, void OutputLinkLibraries(std::string& linkLibraries,
std::string& frameworkPath, std::string& frameworkPath,
std::string& linkPath, std::string& linkPath,
cmGeneratorTarget &, cmGeneratorTarget &,
@ -447,9 +447,6 @@ protected:
definition. Issues a warning. */ definition. Issues a warning. */
virtual bool CheckDefinition(std::string const& define) const; virtual bool CheckDefinition(std::string const& define) const;
/** Read the input CMakeLists.txt file. */
void ReadInputFile();
cmMakefile *Makefile; cmMakefile *Makefile;
cmState::Snapshot StateSnapshot; cmState::Snapshot StateSnapshot;
cmGlobalGenerator *GlobalGenerator; cmGlobalGenerator *GlobalGenerator;

View File

@ -626,7 +626,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
install_name_dir = install_name_dir =
this->LocalGenerator->Convert(install_name_dir, this->LocalGenerator->Convert(install_name_dir,
cmLocalGenerator::NONE, cmLocalGenerator::NONE,
cmLocalGenerator::SHELL, false); cmLocalGenerator::SHELL);
vars.TargetInstallNameDir = install_name_dir.c_str(); vars.TargetInstallNameDir = install_name_dir.c_str();
} }
} }

View File

@ -525,8 +525,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
{ {
vars["INSTALLNAME_DIR"] = localGen.Convert(install_dir, vars["INSTALLNAME_DIR"] = localGen.Convert(install_dir,
cmLocalGenerator::NONE, cmLocalGenerator::NONE,
cmLocalGenerator::SHELL, cmLocalGenerator::SHELL);
false);
} }
} }
} }

View File

@ -456,8 +456,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::vector<std::string> includeDirs; std::vector<std::string> includeDirs;
cmSystemTools::ExpandListArgument(includes, includeDirs); cmSystemTools::ExpandListArgument(includes, includeDirs);
std::string includeFlags = lg->GetIncludeFlags(includeDirs, 0, std::string includeFlags = lg->GetIncludeFlags(includeDirs, 0, language);
language, false);
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS"); std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
printf("%s %s\n", includeFlags.c_str(), definitions.c_str()); printf("%s %s\n", includeFlags.c_str(), definitions.c_str());