ENH: add an ability to specify a build run directory

This commit is contained in:
Bill Hoffman 2004-01-09 13:35:18 -05:00
parent 972e09029d
commit 67f1dab2b5
2 changed files with 17 additions and 1 deletions

View File

@ -3703,6 +3703,11 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
i++;
m_BuildTarget = args[i];
}
if(arg.find("--build-run-dir",0) == 0 && i < args.size() - 1)
{
i++;
m_BuildRunDir = args[i];
}
if(arg.find("--build-two-config",0) == 0 && i < args.size() - 1)
{
m_BuildTwoConfig = true;
@ -4050,6 +4055,11 @@ int cmCTest::RunCMakeAndTest(std::string* outstring)
*outstring += output;
}
if(m_TestCommand.size() == 0)
{
return retVal;
}
// now run the compiled test if we can find it
// See if the executable exists as written.
std::vector<std::string> failed;
@ -4150,6 +4160,11 @@ int cmCTest::RunCMakeAndTest(std::string* outstring)
std::string outs;
int retval = 0;
out << "Running test executable: " << fullPath << "\n";
// run the test from the m_BuildRunDir if set
if(m_BuildRunDir.size())
{
cmSystemTools::ChangeDirectory(m_BuildRunDir.c_str());
}
this->RunTest(testCommand, &outs, &retval);
out << outs << "\n";
if(outstring)

View File

@ -298,6 +298,7 @@ private:
std::string m_CTestSelf;
std::string m_SourceDir;
std::string m_BinaryDir;
std::string m_BuildRunDir;
std::string m_BuildGenerator;
std::string m_BuildMakeProgram;
std::string m_BuildProject;