Merge topic 'minor-cleanups'

7f551b4f cmGlobalGenerator: Implement VS6 check without virtual method.
cd6293cd cmMakefile: Fix style.
de6b2895 cmTarget: Remove vestigal method declaration.
e35ee02d cmTarget: Fix indentation.
00f2298f Reduce uses of cmMakefile::GetGlobalGenerator.
6254ba95 cmMakefile: Remove Internal class.
cf0a78dc cmGeneratorTarget: Issue messages through the local generator.
This commit is contained in:
Brad King 2015-08-27 10:04:12 -04:00 committed by CMake Topic Stage
commit 445077cbd2
9 changed files with 25 additions and 34 deletions

View File

@ -12,6 +12,7 @@
#include "cmComputeLinkDepends.h" #include "cmComputeLinkDepends.h"
#include "cmComputeComponentGraph.h" #include "cmComputeComponentGraph.h"
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmTarget.h" #include "cmTarget.h"
@ -177,7 +178,8 @@ cmComputeLinkDepends
// Store context information. // Store context information.
this->Target = target; this->Target = target;
this->Makefile = this->Target->Target->GetMakefile(); this->Makefile = this->Target->Target->GetMakefile();
this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); this->GlobalGenerator =
this->Target->GetLocalGenerator()->GetGlobalGenerator();
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
// The configuration being linked. // The configuration being linked.

View File

@ -769,7 +769,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
std::string lib; std::string lib;
if(tgt) if(tgt)
{ {
gtgt = tgt->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(tgt); gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt);
lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary); lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary);
this->AddLibraryRuntimeInfo(lib, tgt); this->AddLibraryRuntimeInfo(lib, tgt);

View File

@ -1228,7 +1228,7 @@ public:
: Preference(0), Target(target) : Preference(0), Target(target)
{ {
this->Makefile = this->Target->Makefile; this->Makefile = this->Target->Makefile;
this->GG = this->Makefile->GetGlobalGenerator(); this->GG = this->Target->GetLocalGenerator()->GetGlobalGenerator();
} }
void Consider(const char* lang) void Consider(const char* lang)
{ {
@ -1403,7 +1403,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
msg += this->GetName(); msg += this->GetName();
msg += " which has type "; msg += " which has type ";
msg += cmTarget::GetTargetTypeName(this->Target->GetType()); msg += cmTarget::GetTargetTypeName(this->Target->GetType());
this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, msg); this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
return 0; return 0;
} }
@ -2093,7 +2093,7 @@ cmGeneratorTarget::NormalGetRealName(const std::string& config) const
{ {
std::string msg = "NormalGetRealName called on imported target: "; std::string msg = "NormalGetRealName called on imported target: ";
msg += this->GetName(); msg += this->GetName();
this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, msg); this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
} }
if(this->GetType() == cmTarget::EXECUTABLE) if(this->GetType() == cmTarget::EXECUTABLE)

View File

@ -242,7 +242,7 @@ public:
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
/** Is this the Visual Studio 6 generator? */ /** Is this the Visual Studio 6 generator? */
virtual bool IsForVS6() const { return false; } bool IsForVS6() const { return this->GetName() == "Visual Studio 6"; }
#endif #endif
///! Find a target by name by searching the local generators. ///! Find a target by name by searching the local generators.

View File

@ -85,8 +85,6 @@ public:
virtual void FindMakeProgram(cmMakefile*); virtual void FindMakeProgram(cmMakefile*);
virtual bool IsForVS6() const { return true; }
protected: protected:
virtual void Generate(); virtual void Generate();
virtual const char* GetIDEVersion() { return "6.0"; } virtual const char* GetIDEVersion() { return "6.0"; }

View File

@ -43,19 +43,12 @@
#include <ctype.h> // for isspace #include <ctype.h> // for isspace
#include <assert.h> #include <assert.h>
class cmMakefile::Internals
{
public:
bool IsSourceFileTryCompile;
};
// default is not to be building executables // default is not to be building executables
cmMakefile::cmMakefile(cmLocalGenerator* localGenerator) cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
: Internal(new Internals), : LocalGenerator(localGenerator),
LocalGenerator(localGenerator),
StateSnapshot(localGenerator->GetStateSnapshot()) StateSnapshot(localGenerator->GetStateSnapshot())
{ {
this->Internal->IsSourceFileTryCompile = false; this->IsSourceFileTryCompile = false;
// Initialize these first since AddDefaultDefinitions calls AddDefinition // Initialize these first since AddDefaultDefinitions calls AddDefinition
this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused(); this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
@ -2083,7 +2076,8 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name,
if(std::find(this->LinkDirectories.begin(), if(std::find(this->LinkDirectories.begin(),
this->LinkDirectories.end(), newdir) this->LinkDirectories.end(), newdir)
== this->LinkDirectories.end()) == this->LinkDirectories.end())
{target.AddLinkDirectory(*j); {
target.AddLinkDirectory(*j);
} }
} }
} }
@ -3620,7 +3614,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
const std::vector<std::string> *cmakeArgs, const std::vector<std::string> *cmakeArgs,
std::string& output) std::string& output)
{ {
this->Internal->IsSourceFileTryCompile = fast; this->IsSourceFileTryCompile = fast;
// does the binary directory exist ? If not create it... // does the binary directory exist ? If not create it...
if (!cmSystemTools::FileIsDirectory(bindir)) if (!cmSystemTools::FileIsDirectory(bindir))
{ {
@ -3645,7 +3639,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
"Internal CMake error, TryCompile bad GlobalGenerator"); "Internal CMake error, TryCompile bad GlobalGenerator");
// return to the original directory // return to the original directory
cmSystemTools::ChangeDirectory(cwd); cmSystemTools::ChangeDirectory(cwd);
this->Internal->IsSourceFileTryCompile = false; this->IsSourceFileTryCompile = false;
return 1; return 1;
} }
cm.SetGlobalGenerator(gg); cm.SetGlobalGenerator(gg);
@ -3716,7 +3710,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
"Internal CMake error, TryCompile configure of cmake failed"); "Internal CMake error, TryCompile configure of cmake failed");
// return to the original directory // return to the original directory
cmSystemTools::ChangeDirectory(cwd); cmSystemTools::ChangeDirectory(cwd);
this->Internal->IsSourceFileTryCompile = false; this->IsSourceFileTryCompile = false;
return 1; return 1;
} }
@ -3726,7 +3720,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
"Internal CMake error, TryCompile generation of cmake failed"); "Internal CMake error, TryCompile generation of cmake failed");
// return to the original directory // return to the original directory
cmSystemTools::ChangeDirectory(cwd); cmSystemTools::ChangeDirectory(cwd);
this->Internal->IsSourceFileTryCompile = false; this->IsSourceFileTryCompile = false;
return 1; return 1;
} }
@ -3739,13 +3733,13 @@ int cmMakefile::TryCompile(const std::string& srcdir,
this); this);
cmSystemTools::ChangeDirectory(cwd); cmSystemTools::ChangeDirectory(cwd);
this->Internal->IsSourceFileTryCompile = false; this->IsSourceFileTryCompile = false;
return ret; return ret;
} }
bool cmMakefile::GetIsSourceFileTryCompile() const bool cmMakefile::GetIsSourceFileTryCompile() const
{ {
return this->Internal->IsSourceFileTryCompile; return this->IsSourceFileTryCompile;
} }
cmake *cmMakefile::GetCMakeInstance() const cmake *cmMakefile::GetCMakeInstance() const

View File

@ -62,8 +62,6 @@ class cmGeneratorExpressionEvaluationFile;
*/ */
class cmMakefile class cmMakefile
{ {
class Internals;
cmsys::auto_ptr<Internals> Internal;
public: public:
/* Mark a variable as used */ /* Mark a variable as used */
void MarkVariableAsUsed(const std::string& var); void MarkVariableAsUsed(const std::string& var);
@ -991,6 +989,7 @@ private:
bool CheckSystemVars; bool CheckSystemVars;
bool CheckCMP0000; bool CheckCMP0000;
bool Configured; bool Configured;
bool IsSourceFileTryCompile;
mutable bool SuppressWatches; mutable bool SuppressWatches;
}; };

View File

@ -1842,12 +1842,12 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return; return;
} }
this->Internal->SourceFilesMap.clear(); this->Internal->SourceFilesMap.clear();
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
this->Internal->SourceEntries.push_back( this->Internal->SourceEntries.push_back(
new cmTargetInternals::TargetPropertyEntry(cge)); new cmTargetInternals::TargetPropertyEntry(cge));
} }
else else
{ {

View File

@ -614,8 +614,6 @@ private:
void MaybeInvalidatePropertyCache(const std::string& prop); void MaybeInvalidatePropertyCache(const std::string& prop);
void ProcessSourceExpression(std::string const& expr);
// Internal representation details. // Internal representation details.
friend class cmTargetInternals; friend class cmTargetInternals;
friend class cmGeneratorTarget; friend class cmGeneratorTarget;