BUG: when ctest is looking for cmake look in the build directory as well as where ctest is so that purify will work

This commit is contained in:
Bill Hoffman 2005-01-17 16:29:00 -05:00
parent e7bc462755
commit 57bacd199c
1 changed files with 30 additions and 12 deletions

View File

@ -1626,7 +1626,7 @@ void cmCTest::FindRunningCMake(const char* arg0)
{ {
failures.push_back(m_CTestSelf); failures.push_back(m_CTestSelf);
cmOStringStream msg; cmOStringStream msg;
msg << "CTEST can not find the command line program cmake.\n"; msg << "CTEST can not find the command line program ctest.\n";
msg << " argv[0] = \"" << arg0 << "\"\n"; msg << " argv[0] = \"" << arg0 << "\"\n";
msg << " Attempted paths:\n"; msg << " Attempted paths:\n";
std::vector<cmStdString>::iterator i; std::vector<cmStdString>::iterator i;
@ -1639,23 +1639,41 @@ void cmCTest::FindRunningCMake(const char* arg0)
std::string dir; std::string dir;
std::string file; std::string file;
if(cmSystemTools::SplitProgramPath(m_CTestSelf.c_str(), if(cmSystemTools::SplitProgramPath(m_CTestSelf.c_str(),
dir, dir, file, true))
file,
true))
{ {
m_CMakeSelf = dir += "/cmake"; m_CMakeSelf = dir += "/cmake";
m_CMakeSelf += cmSystemTools::GetExecutableExtension(); m_CMakeSelf += cmSystemTools::GetExecutableExtension();
if(!cmSystemTools::FileExists(m_CMakeSelf.c_str())) if(cmSystemTools::FileExists(m_CMakeSelf.c_str()))
{ {
cmOStringStream msg; return;
failures.push_back(m_CMakeSelf);
msg << "CTEST can not find the command line program cmake.\n";
msg << " argv[0] = \"" << arg0 << "\"\n";
msg << " Attempted path:\n";
msg << " \"" << m_CMakeSelf.c_str() << "\"\n";
cmSystemTools::Error(msg.str().c_str());
} }
} }
failures.push_back(m_CMakeSelf);
#ifdef CMAKE_BUILD_DIR
std::string intdir = ".";
#ifdef CMAKE_INTDIR
intdir = CMAKE_INTDIR;
#endif
m_CMakeSelf = CMAKE_BUILD_DIR;
m_CMakeSelf += "/bin/";
m_CMakeSelf += intdir;
m_CMakeSelf += "/cmake";
m_CMakeSelf += cmSystemTools::GetExecutableExtension();
#endif
if(!cmSystemTools::FileExists(m_CMakeSelf.c_str()))
{
failures.push_back(m_CMakeSelf);
cmOStringStream msg;
msg << "CTEST can not find the command line program cmake.\n";
msg << " argv[0] = \"" << arg0 << "\"\n";
msg << " Attempted paths:\n";
std::vector<cmStdString>::iterator i;
for(i=failures.begin(); i != failures.end(); ++i)
{
msg << " \"" << i->c_str() << "\"\n";
}
cmSystemTools::Error(msg.str().c_str());
}
} }
void CMakeMessageCallback(const char* m, const char*, bool&, void* s) void CMakeMessageCallback(const char* m, const char*, bool&, void* s)