diff options
-rw-r--r-- | Source/cmLocalGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 78 | ||||
-rw-r--r-- | Source/cmMakefile.h | 9 |
3 files changed, 38 insertions, 52 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6d17171..6b705e8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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() diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a00b8eb..8c6b195 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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 diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index dcf56e1..d120fb3 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -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;} |