cmMakefile: Require the localGenerator in the constructor.
Move the contents of cmMakeile::SetLocalGenerator to the Initialize method.
This commit is contained in:
parent
a48aebcb67
commit
86f3cd0f7e
|
@ -253,8 +253,7 @@ void cmLocalGenerator::SetupPathConversions()
|
|||
void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg)
|
||||
{
|
||||
this->GlobalGenerator = gg;
|
||||
this->Makefile = new cmMakefile;
|
||||
this->Makefile->SetLocalGenerator(this);
|
||||
this->Makefile = new cmMakefile(this);
|
||||
}
|
||||
|
||||
void cmLocalGenerator::ConfigureFinalPass()
|
||||
|
|
|
@ -53,7 +53,8 @@ public:
|
|||
};
|
||||
|
||||
// default is not to be building executables
|
||||
cmMakefile::cmMakefile(): Internal(new Internals)
|
||||
cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
|
||||
: Internal(new Internals)
|
||||
{
|
||||
const cmDefinitions& defs = cmDefinitions();
|
||||
const std::set<std::string> globalKeys = defs.LocalKeys();
|
||||
|
@ -97,7 +98,7 @@ cmMakefile::cmMakefile(): Internal(new Internals)
|
|||
this->HeaderFileExtensions.push_back( "txx" );
|
||||
|
||||
this->DefineFlags = " ";
|
||||
this->LocalGenerator = 0;
|
||||
this->LocalGenerator = localGenerator;
|
||||
|
||||
this->AddDefaultDefinitions();
|
||||
this->Initialize();
|
||||
|
@ -126,6 +127,39 @@ void cmMakefile::Initialize()
|
|||
// By default the check is not done. It is enabled by
|
||||
// cmListFileCache in the top level if necessary.
|
||||
this->CheckCMP0000 = false;
|
||||
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
this->AddSourceGroup("", "^.*$");
|
||||
this->AddSourceGroup
|
||||
("Source Files",
|
||||
"\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp"
|
||||
"|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$");
|
||||
this->AddSourceGroup("Header Files", CM_HEADER_REGEX);
|
||||
this->AddSourceGroup("CMake Rules", "\\.rule$");
|
||||
this->AddSourceGroup("Resources", "\\.plist$");
|
||||
this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
|
||||
#endif
|
||||
|
||||
this->Properties.SetCMakeInstance(this->GetCMakeInstance());
|
||||
this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
|
||||
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
|
||||
|
||||
{
|
||||
const char* dir = this->GetCMakeInstance()->GetHomeDirectory();
|
||||
this->AddDefinition("CMAKE_SOURCE_DIR", dir);
|
||||
if ( !this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR") )
|
||||
{
|
||||
this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", dir);
|
||||
}
|
||||
}
|
||||
{
|
||||
const char* dir = this->GetCMakeInstance()->GetHomeOutputDirectory();
|
||||
this->AddDefinition("CMAKE_BINARY_DIR", dir);
|
||||
if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") )
|
||||
{
|
||||
this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmMakefile::~cmMakefile()
|
||||
|
@ -630,46 +664,6 @@ void cmMakefile::EnforceDirectoryLevelRules() const
|
|||
}
|
||||
}
|
||||
|
||||
// Set the make file
|
||||
void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
|
||||
{
|
||||
this->LocalGenerator = lg;
|
||||
// the source groups need to access the global generator
|
||||
// so don't create them until the lg is set
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
this->AddSourceGroup("", "^.*$");
|
||||
this->AddSourceGroup
|
||||
("Source Files",
|
||||
"\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp"
|
||||
"|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$");
|
||||
this->AddSourceGroup("Header Files", CM_HEADER_REGEX);
|
||||
this->AddSourceGroup("CMake Rules", "\\.rule$");
|
||||
this->AddSourceGroup("Resources", "\\.plist$");
|
||||
this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
|
||||
#endif
|
||||
|
||||
this->Properties.SetCMakeInstance(this->GetCMakeInstance());
|
||||
this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
|
||||
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
|
||||
|
||||
{
|
||||
const char* dir = this->GetCMakeInstance()->GetHomeDirectory();
|
||||
this->AddDefinition("CMAKE_SOURCE_DIR", dir);
|
||||
if ( !this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR") )
|
||||
{
|
||||
this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", dir);
|
||||
}
|
||||
}
|
||||
{
|
||||
const char* dir = this->GetCMakeInstance()->GetHomeOutputDirectory();
|
||||
this->AddDefinition("CMAKE_BINARY_DIR", dir);
|
||||
if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") )
|
||||
{
|
||||
this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct file_not_persistent
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
/**
|
||||
* Construct an empty makefile.
|
||||
*/
|
||||
cmMakefile();
|
||||
cmMakefile(cmLocalGenerator* localGenerator);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
|
@ -138,13 +138,6 @@ public:
|
|||
|
||||
bool GetIsSourceFileTryCompile() const;
|
||||
|
||||
/**
|
||||
* Specify the makefile generator. This is platform/compiler
|
||||
* dependent, although the interface is through a generic
|
||||
* superclass.
|
||||
*/
|
||||
void SetLocalGenerator(cmLocalGenerator*);
|
||||
|
||||
///! Get the current makefile generator.
|
||||
cmLocalGenerator* GetLocalGenerator() const
|
||||
{ return this->LocalGenerator;}
|
||||
|
|
Loading…
Reference in New Issue