BUG: Fixed crash of cmake -i when CMAKE_ROOT cannot be found. Made resulting error message cleaner.

This commit is contained in:
Brad King 2003-08-26 15:06:52 -04:00
parent c59cc5a542
commit 41445f67ac
4 changed files with 17 additions and 9 deletions

View File

@ -544,9 +544,10 @@ int cmake::AddCMakePaths(const char *arg0)
if (!cmSystemTools::FileExists(modules.c_str())) if (!cmSystemTools::FileExists(modules.c_str()))
{ {
// couldn't find modules // couldn't find modules
cmSystemTools::Error("Could not find CMAKE_ROOT !!!\n", cmSystemTools::Error("Could not find CMAKE_ROOT !!!\n"
"Modules directory not in directory:\n", "CMake has most likely not been installed correctly.\n"
modules.c_str()); "Modules directory not found in\n",
cMakeRoot.c_str());
return 0; return 0;
} }
this->m_CacheManager->AddCacheEntry this->m_CacheManager->AddCacheEntry
@ -1058,6 +1059,10 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
int cmake::Generate() int cmake::Generate()
{ {
if(!m_GlobalGenerator)
{
return -1;
}
m_GlobalGenerator->Generate(); m_GlobalGenerator->Generate();
if(cmSystemTools::GetErrorOccuredFlag()) if(cmSystemTools::GetErrorOccuredFlag())
{ {

View File

@ -196,8 +196,7 @@ int do_cmake(int ac, char** av)
if (wiz) if (wiz)
{ {
cmakewizard wizard; cmakewizard wizard;
wizard.RunWizard(args); return wizard.RunWizard(args);
return 0;
} }
cmake cm; cmake cm;
cm.SetProgressCallback(updateProgress, 0); cm.SetProgressCallback(updateProgress, 0);

View File

@ -89,7 +89,7 @@ void cmakewizard::ShowMessage(const char* m)
void cmakewizard::RunWizard(std::vector<std::string> const& args) int cmakewizard::RunWizard(std::vector<std::string> const& args)
{ {
m_ShowAdvanced = this->AskAdvanced(); m_ShowAdvanced = this->AskAdvanced();
cmSystemTools::DisableRunCommandOutput(); cmSystemTools::DisableRunCommandOutput();
@ -148,6 +148,10 @@ void cmakewizard::RunWizard(std::vector<std::string> const& args)
cachem->SaveCache(make.GetHomeOutputDirectory()); cachem->SaveCache(make.GetHomeOutputDirectory());
} }
while(asked); while(asked);
make.Generate(); if(make.Generate() == 0)
{
this->ShowMessage("CMake complete, run make to build project.\n"); this->ShowMessage("CMake complete, run make to build project.\n");
return 0;
}
return 1;
} }

View File

@ -38,7 +38,7 @@ public:
* Run cmake in wizard mode. This will coninue to ask the user questions * Run cmake in wizard mode. This will coninue to ask the user questions
* until there are no more entries in the cache. * until there are no more entries in the cache.
*/ */
void RunWizard(std::vector<std::string>const& args); int RunWizard(std::vector<std::string>const& args);
private: private:
bool m_ShowAdvanced; bool m_ShowAdvanced;