Merge topic 'minor-cleanups'

f5b0a0fb cmMakefile: Don't pop the directory listfile off the stack.
e40fcb59 cmMakefile: Simplify convert condition.
4fdad392 cmake: Remove redundant forward declaration.
df9635f3 cmake: Remove redundant condition.
ad167479 foreach: Remove unused variables.
aaeec642 cmGlobalGenerator: De-virtualize methods with no overrides.
444bc349 Ninja: Remove some bogus comments.
This commit is contained in:
Brad King 2015-05-27 09:22:57 -04:00 committed by CMake Topic Stage
commit 95bab020b3
6 changed files with 14 additions and 38 deletions

View File

@ -44,8 +44,6 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
std::vector<std::string>::const_iterator j = this->Args.begin(); std::vector<std::string>::const_iterator j = this->Args.begin();
++j; ++j;
std::string tmps;
cmListFileArgument arg;
for( ; j != this->Args.end(); ++j) for( ; j != this->Args.end(); ++j)
{ {
// set the variable to the loop value // set the variable to the loop value

View File

@ -121,7 +121,7 @@ public:
* Try running cmake and building a file. This is used for dynamically * Try running cmake and building a file. This is used for dynamically
* loaded commands, not as part of the usual build process. * loaded commands, not as part of the usual build process.
*/ */
virtual int TryCompile(const std::string& srcdir, const std::string& bindir, int TryCompile(const std::string& srcdir, const std::string& bindir,
const std::string& projectName, const std::string& projectName,
const std::string& targetName, const std::string& targetName,
bool fast, std::string& output, cmMakefile* mf); bool fast, std::string& output, cmMakefile* mf);
@ -371,7 +371,7 @@ protected:
typedef std::vector<cmLocalGenerator*> GeneratorVector; typedef std::vector<cmLocalGenerator*> GeneratorVector;
// for a project collect all its targets by following depend // for a project collect all its targets by following depend
// information, and also collect all the targets // information, and also collect all the targets
virtual void GetTargetSets(TargetDependSet& projectTargets, void GetTargetSets(TargetDependSet& projectTargets,
TargetDependSet& originalTargets, TargetDependSet& originalTargets,
cmLocalGenerator* root, GeneratorVector const&); cmLocalGenerator* root, GeneratorVector const&);
bool IsRootOnlyTarget(cmTarget* target) const; bool IsRootOnlyTarget(cmTarget* target) const;
@ -446,7 +446,7 @@ protected:
TargetMap ImportedTargets; TargetMap ImportedTargets;
std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles; std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
virtual const char* GetPredefinedTargetsFolder(); const char* GetPredefinedTargetsFolder();
virtual bool UseFolderProperty(); virtual bool UseFolderProperty();
private: private:

View File

@ -31,28 +31,19 @@ class cmake;
class cmLocalNinjaGenerator : public cmLocalGenerator class cmLocalNinjaGenerator : public cmLocalGenerator
{ {
public: public:
/// Default constructor.
cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent); cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
/// Destructor.
virtual ~cmLocalNinjaGenerator(); virtual ~cmLocalNinjaGenerator();
/// Overloaded methods. @see cmLocalGenerator::Generate()
virtual void Generate(); virtual void Generate();
/// Overloaded methods. @see cmLocalGenerator::Configure()
virtual void Configure(); virtual void Configure();
/// Overloaded methods. @see cmLocalGenerator::GetTargetDirectory()
virtual std::string GetTargetDirectory(cmTarget const& target) const; virtual std::string GetTargetDirectory(cmTarget const& target) const;
const cmGlobalNinjaGenerator* GetGlobalNinjaGenerator() const; const cmGlobalNinjaGenerator* GetGlobalNinjaGenerator() const;
cmGlobalNinjaGenerator* GetGlobalNinjaGenerator(); cmGlobalNinjaGenerator* GetGlobalNinjaGenerator();
/**
* Shortcut to get the cmake instance throw the global generator.
* @return an instance of the cmake object.
*/
const cmake* GetCMakeInstance() const; const cmake* GetCMakeInstance() const;
cmake* GetCMakeInstance(); cmake* GetCMakeInstance();

View File

@ -260,20 +260,11 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
else else
{ {
cmListFileContext lfc; cmListFileContext lfc;
if(this->ListFileStack.empty()) // We are not currently executing a command. Add whatever context
{ // information we have.
// We are not processing the project. Add the directory-level context. lfc.FilePath = this->ListFileStack.back();
lfc.FilePath = this->GetCurrentSourceDirectory();
lfc.FilePath += "/CMakeLists.txt"; if(!this->GetCMakeInstance()->GetIsInTryCompile())
}
else
{
// We are processing the project but are not currently executing a
// command. Add whatever context information we have.
lfc.FilePath = this->ListFileStack.back();
}
if(!this->CallStack.empty()
|| !this->GetCMakeInstance()->GetIsInTryCompile())
{ {
lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath,
cmLocalGenerator::HOME); cmLocalGenerator::HOME);
@ -536,12 +527,16 @@ bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope)
{ {
this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->AddDefinition("CMAKE_PARENT_LIST_FILE",
this->GetDefinition("CMAKE_CURRENT_LIST_FILE")); this->GetDefinition("CMAKE_CURRENT_LIST_FILE"));
return this->ReadListFile(listfile, noPolicyScope, false); bool result = this->ReadListFile(listfile, noPolicyScope, false);
this->ListFileStack.pop_back();
return result;
} }
bool cmMakefile::ReadListFile(const char* listfile) bool cmMakefile::ReadListFile(const char* listfile)
{ {
return this->ReadListFile(listfile, true, false); bool result = this->ReadListFile(listfile, true, false);
this->ListFileStack.pop_back();
return result;
} }
bool cmMakefile::ReadListFile(const char* listfile, bool cmMakefile::ReadListFile(const char* listfile,
@ -578,8 +573,6 @@ bool cmMakefile::ReadListFile(const char* listfile,
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
this->ListFileStack.pop_back();
if (res) if (res)
{ {
this->CheckForUnusedVariables(); this->CheckForUnusedVariables();

View File

@ -1620,11 +1620,6 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
std::string message = "Build files have been written to: "; std::string message = "Build files have been written to: ";
message += this->GetHomeOutputDirectory(); message += this->GetHomeOutputDirectory();
this->UpdateProgress(message.c_str(), -1); this->UpdateProgress(message.c_str(), -1);
if(ret)
{
return ret;
}
return ret; return ret;
} }

View File

@ -30,7 +30,6 @@ class cmDocumentationSection;
class cmPolicies; class cmPolicies;
class cmTarget; class cmTarget;
class cmGeneratedFileStream; class cmGeneratedFileStream;
class cmState;
/** \brief Represents a cmake invocation. /** \brief Represents a cmake invocation.
* *