ENH: More debugging and work on PackageMaker code
This commit is contained in:
parent
17c3a89797
commit
b9c4cff45a
|
@ -328,12 +328,13 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
|
|||
// do CMAKE_ROOT, look for the environment variable first
|
||||
std::string cMakeRoot;
|
||||
std::string modules;
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT" << std::endl);
|
||||
if (getenv("CMAKE_ROOT"))
|
||||
{
|
||||
cMakeRoot = getenv("CMAKE_ROOT");
|
||||
modules = cMakeRoot + "/Modules/CMake.cmake";
|
||||
}
|
||||
if(!cmSystemTools::FileExists(modules.c_str()))
|
||||
if(modules.empty() || !cmSystemTools::FileExists(modules.c_str()))
|
||||
{
|
||||
// next try exe/..
|
||||
cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str());
|
||||
|
@ -344,6 +345,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
|
|||
}
|
||||
// is there no Modules direcory there?
|
||||
modules = cMakeRoot + "/Modules/CMake.cmake";
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
|
||||
}
|
||||
|
||||
if (!cmSystemTools::FileExists(modules.c_str()))
|
||||
|
@ -351,6 +353,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
|
|||
// try exe/../share/cmake
|
||||
cMakeRoot += CMAKE_DATA_DIR;
|
||||
modules = cMakeRoot + "/Modules/CMake.cmake";
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
|
||||
}
|
||||
#ifdef CMAKE_ROOT_DIR
|
||||
if (!cmSystemTools::FileExists(modules.c_str()))
|
||||
|
@ -358,6 +361,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
|
|||
// try compiled in root directory
|
||||
cMakeRoot = CMAKE_ROOT_DIR;
|
||||
modules = cMakeRoot + "/Modules/CMake.cmake";
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
|
||||
}
|
||||
#endif
|
||||
#ifdef CMAKE_PREFIX
|
||||
|
@ -366,6 +370,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
|
|||
// try compiled in install prefix
|
||||
cMakeRoot = CMAKE_PREFIX CMAKE_DATA_DIR;
|
||||
modules = cMakeRoot + "/Modules/CMake.cmake";
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
|
||||
}
|
||||
#endif
|
||||
if (!cmSystemTools::FileExists(modules.c_str()))
|
||||
|
@ -374,6 +379,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
|
|||
cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str());
|
||||
cMakeRoot += CMAKE_DATA_DIR;
|
||||
modules = cMakeRoot + "/Modules/CMake.cmake";
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
|
||||
}
|
||||
if(!cmSystemTools::FileExists(modules.c_str()))
|
||||
{
|
||||
|
@ -381,6 +387,7 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
|
|||
cMakeRoot = cmSystemTools::GetProgramPath(m_CMakeSelf.c_str());
|
||||
// is there no Modules direcory there?
|
||||
modules = cMakeRoot + "/Modules/CMake.cmake";
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Looking for CMAKE_ROOT: " << modules.c_str() << std::endl);
|
||||
}
|
||||
if (!cmSystemTools::FileExists(modules.c_str()))
|
||||
{
|
||||
|
@ -392,6 +399,8 @@ int cmCPackGenericGenerator::FindRunningCMake(const char* arg0)
|
|||
return 0;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -441,7 +450,10 @@ const char* cmCPackGenericGenerator::GetInstallPath()
|
|||
//----------------------------------------------------------------------
|
||||
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;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -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);
|
||||
parsed = 0;
|
||||
}
|
||||
cpackGenerator->Initialize(gen, mf);
|
||||
if ( !cpackGenerator->Initialize(gen, mf) )
|
||||
{
|
||||
parsed = 0;
|
||||
}
|
||||
if ( parsed && !cpackGenerator->FindRunningCMake(argv[0]) )
|
||||
{
|
||||
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();
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue