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

View File

@ -395,7 +395,7 @@ public:
protected:
///! 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& linkPath,
cmGeneratorTarget &,
@ -447,9 +447,6 @@ protected:
definition. Issues a warning. */
virtual bool CheckDefinition(std::string const& define) const;
/** Read the input CMakeLists.txt file. */
void ReadInputFile();
cmMakefile *Makefile;
cmState::Snapshot StateSnapshot;
cmGlobalGenerator *GlobalGenerator;

View File

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

View File

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

View File

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