ENH: More debugging and work on PackageMaker code

This commit is contained in:
Andy Cedilnik 2006-01-05 13:27:48 -05:00
parent 17c3a89797
commit b9c4cff45a
2 changed files with 19 additions and 4 deletions

View File

@ -328,12 +328,13 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
// do CMAKE_ROOT, look for the environment variable first // do CMAKE_ROOT, look for the environment variable first
std::string cMakeRoot; std::string cMakeRoot;
std::string modules; std::string modules;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT" << std::endl);
if (getenv("CMAKE_ROOT")) if (getenv("CMAKE_ROOT"))
{ {
cMakeRoot = getenv("CMAKE_ROOT"); cMakeRoot = getenv("CMAKE_ROOT");
modules = cMakeRoot + "/Modules/CMake.cmake"; modules = cMakeRoot + "/Modules/CMake.cmake";
} }
if(!cmSystemTools::FileExists(modules.c_str())) if(modules.empty() || !cmSystemTools::FileExists(modules.c_str()))
{ {
// next try exe/.. // next try exe/..
cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str()); cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str());
@ -344,6 +345,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
} }
// is there no Modules direcory there? // is there no Modules direcory there?
modules = cMakeRoot + "/Modules/CMake.cmake"; modules = cMakeRoot + "/Modules/CMake.cmake";
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
} }
if (!cmSystemTools::FileExists(modules.c_str())) if (!cmSystemTools::FileExists(modules.c_str()))
@ -351,6 +353,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
// try exe/../share/cmake // try exe/../share/cmake
cMakeRoot += CMAKE_DATA_DIR; cMakeRoot += CMAKE_DATA_DIR;
modules = cMakeRoot + "/Modules/CMake.cmake"; modules = cMakeRoot + "/Modules/CMake.cmake";
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
} }
#ifdef CMAKE_ROOT_DIR #ifdef CMAKE_ROOT_DIR
if (!cmSystemTools::FileExists(modules.c_str())) if (!cmSystemTools::FileExists(modules.c_str()))
@ -358,6 +361,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
// try compiled in root directory // try compiled in root directory
cMakeRoot = CMAKE_ROOT_DIR; cMakeRoot = CMAKE_ROOT_DIR;
modules = cMakeRoot + "/Modules/CMake.cmake"; modules = cMakeRoot + "/Modules/CMake.cmake";
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
} }
#endif #endif
#ifdef CMAKE_PREFIX #ifdef CMAKE_PREFIX
@ -366,6 +370,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
// try compiled in install prefix // try compiled in install prefix
cMakeRoot = CMAKE_PREFIX CMAKE_DATA_DIR; cMakeRoot = CMAKE_PREFIX CMAKE_DATA_DIR;
modules = cMakeRoot + "/Modules/CMake.cmake"; modules = cMakeRoot + "/Modules/CMake.cmake";
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
} }
#endif #endif
if (!cmSystemTools::FileExists(modules.c_str())) if (!cmSystemTools::FileExists(modules.c_str()))
@ -374,6 +379,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str()); cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str());
cMakeRoot += CMAKE_DATA_DIR; cMakeRoot += CMAKE_DATA_DIR;
modules = cMakeRoot + "/Modules/CMake.cmake"; modules = cMakeRoot + "/Modules/CMake.cmake";
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
} }
if(!cmSystemTools::FileExists(modules.c_str())) if(!cmSystemTools::FileExists(modules.c_str()))
{ {
@ -381,6 +387,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str()); cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str());
// is there no Modules direcory there? // is there no Modules direcory there?
modules = cMakeRoot + "/Modules/CMake.cmake"; modules = cMakeRoot + "/Modules/CMake.cmake";
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
} }
if (!cmSystemTools::FileExists(modules.c_str())) if (!cmSystemTools::FileExists(modules.c_str()))
{ {
@ -392,6 +399,8 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
return 0; return 0;
} }
m_CMakeRoot = cMakeRoot; m_CMakeRoot = cMakeRoot;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << m_CMakeRoot.c_str() << std::endl);
this->SetOption("CMAKE_ROOT", m_CMakeRoot.c_str());
return 1; return 1;
} }
@ -441,7 +450,10 @@ const char* cmCPackGenericGenerator::GetInstallPath()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
std::string cmCPackGenericGenerator::FindTemplate(const char* name) std::string cmCPackGenericGenerator::FindTemplate(const char* name)
{ {
return m_MakefileMap->GetModulesFile(name); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Look for template: " << name << std::endl);
std::string ffile = m_MakefileMap->GetModulesFile(name);
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Found template: " << ffile.c_str() << std::endl);
return ffile;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -282,7 +282,10 @@ int main (int argc, char *argv[])
cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Cannot initialize CPack generator: " << generator.c_str() << std::endl); cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Cannot initialize CPack generator: " << generator.c_str() << std::endl);
parsed = 0; parsed = 0;
} }
cpackGenerator->Initialize(gen, mf); if ( !cpackGenerator->Initialize(gen, mf) )
{
parsed = 0;
}
if ( parsed && !cpackGenerator->FindRunningCMake(argv[0]) ) if ( parsed && !cpackGenerator->FindRunningCMake(argv[0]) )
{ {
cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Cannot initialize the generator" << std::endl); cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Cannot initialize the generator" << std::endl);
@ -337,7 +340,7 @@ int main (int argc, char *argv[])
int res = cpackGenerator->ProcessGenerator(); int res = cpackGenerator->ProcessGenerator();
if ( !res ) if ( !res )
{ {
cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Error when generating package: " << cpackProjectName.c_str() << std::endl); cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Error when generating package: " << projName << std::endl);
return 1; return 1;
} }