diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 9 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 1 | ||||
-rw-r--r-- | Source/cmake.h | 10 |
3 files changed, 14 insertions, 6 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 869f6cb..2ec4a27 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -186,12 +186,19 @@ cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator() void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen, cmMakefile *mf) { + // create a temp generator + cmLocalGenerator *lg = this->CreateLocalGenerator(); + lg->GetMakefile()->SetStartDirectory(m_CMakeInstance->GetStartDirectory()); + lg->GetMakefile()->SetStartOutputDirectory(m_CMakeInstance->GetStartOutputDirectory()); + lg->GetMakefile()->MakeStartDirectoriesCurrent(); + // for each existing language call enable Language std::map<cmStdString, bool>::const_iterator i = gen->m_LanguageEnabled.begin(); for (;i != gen->m_LanguageEnabled.end(); ++i) { - this->EnableLanguage(i->first.c_str(),mf); + this->EnableLanguage(i->first.c_str(),lg->GetMakefile()); } + delete lg; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fc7622c..e41551a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1352,6 +1352,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, // be run that way but the cmake object requires a vailid path std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND"); cmake cm; + cm.AddCMakePaths(cmakeCommand.c_str()); cm.SetIsInTryCompile(true); cmGlobalGenerator *gg = cm.CreateGlobalGenerator(m_LocalGenerator->GetGlobalGenerator()->GetName()); diff --git a/Source/cmake.h b/Source/cmake.h index 60bde26..3cf1a51 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -181,6 +181,11 @@ class cmake ///! Is this cmake running as a result of a TRY_COMPILE command void SetIsInTryCompile(bool i) { m_InTryCompile = i; } + /** + * Generate CMAKE_ROOT and CMAKE_COMMAND cache entries + */ + int AddCMakePaths(const char *arg0); + protected: typedef std::map<cmStdString, cmCommand*> RegisteredCommandsMap; RegisteredCommandsMap m_Commands; @@ -199,11 +204,6 @@ protected: ///! read in a cmake list file to initialize the cache void ReadListFile(const char *path); - /** - * Generate CMAKE_ROOT and CMAKE_COMMAND cache entries - */ - int AddCMakePaths(const char *arg0); - ///! used by Run int LocalGenerate(); |