BUG: Fixed error message formatting when try run executable command cannot be found.

This commit is contained in:
Brad King 2005-06-21 14:20:30 -04:00
parent 9e9b6a8354
commit 60b72ab3de

View File

@ -72,28 +72,30 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv)
{ {
int retVal = -1; int retVal = -1;
std::string output; std::string output;
std::string command; std::string command1 = binaryDirectory;
command = binaryDirectory; command1 += "/cmTryCompileExec";
command += "/cmTryCompileExec"; command1 += cmSystemTools::GetExecutableExtension();
command += cmSystemTools::GetExecutableExtension();
std::string fullPath; std::string fullPath;
if(cmSystemTools::FileExists(command.c_str())) if(cmSystemTools::FileExists(command1.c_str()))
{ {
fullPath = cmSystemTools::CollapseFullPath(command.c_str()); fullPath = cmSystemTools::CollapseFullPath(command1.c_str());
} }
else else
{ {
command = binaryDirectory; std::string command2 = binaryDirectory;
command += "/Debug/cmTryCompileExec"; command2 += "/Debug/cmTryCompileExec";
command += cmSystemTools::GetExecutableExtension(); command2 += cmSystemTools::GetExecutableExtension();
if(cmSystemTools::FileExists(command.c_str())) if(cmSystemTools::FileExists(command2.c_str()))
{ {
fullPath = cmSystemTools::CollapseFullPath(command.c_str()); fullPath = cmSystemTools::CollapseFullPath(command2.c_str());
} }
else else
{ {
cmSystemTools::Error("Unable to find executable for TRY_RUN", cmOStringStream emsg;
command.c_str()); emsg << "Unable to find executable for TRY_RUN: tried \""
<< command1 << "\" and \""
<< command2 << "\".";
cmSystemTools::Error(emsg.str().c_str());
} }
} }
if (fullPath.size() > 1) if (fullPath.size() > 1)