BUG: Handle -C properly for executables that are not in the project; Fix Bug #344 - ctest -C Debug

This commit is contained in:
Andy Cedilnik 2003-11-11 12:36:03 -05:00
parent 2bb8d871cb
commit 220aea3aee

View File

@ -449,50 +449,46 @@ std::string cmCTest::FindTheExecutable(const char *exe)
std::string file; std::string file;
cmSystemTools::SplitProgramPath(exe, dir, file); cmSystemTools::SplitProgramPath(exe, dir, file);
if(m_ConfigType != "") if(m_ConfigType != "" &&
{ ::TryExecutable(dir.c_str(), file.c_str(), &fullPath,
if(TryExecutable(dir.c_str(), file.c_str(), &fullPath,
m_ConfigType.c_str())) m_ConfigType.c_str()))
{ {
return fullPath; return fullPath;
} }
dir += "/";
dir += m_ConfigType; if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,"."))
dir += "/";
dir += file;
cmSystemTools::Error("config type specified on the command line, but test executable not found.",
dir.c_str());
return "";
}
if (TryExecutable(dir.c_str(),file.c_str(),&fullPath,"."))
{ {
return fullPath; return fullPath;
} }
if (TryExecutable(dir.c_str(),file.c_str(),&fullPath,"")) if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,""))
{ {
return fullPath; return fullPath;
} }
if (TryExecutable(dir.c_str(),file.c_str(),&fullPath,"Release")) if ( m_ConfigType == "" )
{
// No config type, so try to guess it
if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,"Release"))
{ {
return fullPath; return fullPath;
} }
if (TryExecutable(dir.c_str(),file.c_str(),&fullPath,"Debug")) if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,"Debug"))
{ {
return fullPath; return fullPath;
} }
if (TryExecutable(dir.c_str(),file.c_str(),&fullPath,"MinSizeRel")) if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,"MinSizeRel"))
{ {
return fullPath; return fullPath;
} }
if (TryExecutable(dir.c_str(),file.c_str(),&fullPath,"RelWithDebInfo")) if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,"RelWithDebInfo"))
{ {
return fullPath; return fullPath;
} }
}
// if everything else failed, check the users path // if everything else failed, check the users path
if (dir != "") if (dir != "")
@ -504,6 +500,16 @@ std::string cmCTest::FindTheExecutable(const char *exe)
} }
} }
if ( m_ConfigType != "" )
{
dir += "/";
dir += m_ConfigType;
dir += "/";
dir += file;
cmSystemTools::Error("config type specified on the command line, but test executable not found.",
dir.c_str());
return "";
}
return fullPath; return fullPath;
} }