2005-06-04 00:10:55 +04:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
2006-03-09 19:17:10 +03:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
2005-06-04 00:10:55 +04:00
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
|
|
|
|
#include "cmCTestBuildAndTestHandler.h"
|
|
|
|
|
|
|
|
#include "cmSystemTools.h"
|
|
|
|
#include "cmCTest.h"
|
|
|
|
#include "cmake.h"
|
|
|
|
#include "cmGlobalGenerator.h"
|
|
|
|
#include <cmsys/Process.h>
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BuildTwoConfig = false;
|
|
|
|
this->BuildNoClean = false;
|
|
|
|
this->BuildNoCMake = false;
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
|
2005-06-17 21:04:56 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void cmCTestBuildAndTestHandler::Initialize()
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BuildTargets.erase(
|
|
|
|
this->BuildTargets.begin(), this->BuildTargets.end());
|
2005-06-23 21:04:18 +04:00
|
|
|
this->Superclass::Initialize();
|
2005-06-17 21:04:56 +04:00
|
|
|
}
|
|
|
|
|
2005-06-04 00:10:55 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
const char* cmCTestBuildAndTestHandler::GetOutput()
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
return this->Output.c_str();
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int cmCTestBuildAndTestHandler::ProcessHandler()
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->Output = "";
|
2005-06-04 00:10:55 +04:00
|
|
|
std::string output;
|
|
|
|
cmSystemTools::ResetErrorOccuredFlag();
|
2006-03-10 23:03:09 +03:00
|
|
|
int retv = this->RunCMakeAndTest(&this->Output);
|
2005-06-04 00:10:55 +04:00
|
|
|
cmSystemTools::ResetErrorOccuredFlag();
|
|
|
|
return retv;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2006-03-09 19:17:10 +03:00
|
|
|
int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
|
|
|
|
cmOStringStream &out, std::string &cmakeOutString, std::string &cwd,
|
|
|
|
cmake *cm)
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
|
|
|
unsigned int k;
|
|
|
|
std::vector<std::string> args;
|
2006-03-10 23:03:09 +03:00
|
|
|
args.push_back(this->CTest->GetCMakeExecutable());
|
|
|
|
args.push_back(this->SourceDir);
|
|
|
|
if(this->BuildGenerator.size())
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
|
|
|
std::string generator = "-G";
|
2006-03-10 23:03:09 +03:00
|
|
|
generator += this->BuildGenerator;
|
2005-06-04 00:10:55 +04:00
|
|
|
args.push_back(generator);
|
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( this->CTest->GetConfigType().size() > 0 )
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
std::string btype
|
2006-03-10 23:03:09 +03:00
|
|
|
= "-DCMAKE_BUILD_TYPE:STRING=" + this->CTest->GetConfigType();
|
2005-06-04 00:10:55 +04:00
|
|
|
args.push_back(btype);
|
|
|
|
}
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
for(k=0; k < this->BuildOptions.size(); ++k)
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
args.push_back(this->BuildOptions[k]);
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
if (cm->Run(args) != 0)
|
|
|
|
{
|
|
|
|
out << "Error: cmake execution failed\n";
|
|
|
|
out << cmakeOutString << "\n";
|
|
|
|
// return to the original directory
|
|
|
|
cmSystemTools::ChangeDirectory(cwd.c_str());
|
|
|
|
if(outstring)
|
|
|
|
{
|
|
|
|
*outstring = out.str();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, out.str() << std::endl);
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
// do another config?
|
2006-03-10 23:03:09 +03:00
|
|
|
if(this->BuildTwoConfig)
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
|
|
|
if (cm->Run(args) != 0)
|
|
|
|
{
|
|
|
|
out << "Error: cmake execution failed\n";
|
|
|
|
out << cmakeOutString << "\n";
|
|
|
|
// return to the original directory
|
|
|
|
cmSystemTools::ChangeDirectory(cwd.c_str());
|
|
|
|
if(outstring)
|
|
|
|
{
|
|
|
|
*outstring = out.str();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, out.str() << std::endl);
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
}
|
2006-08-08 23:55:41 +04:00
|
|
|
out << "======== CMake output ======\n";
|
|
|
|
out << cmakeOutString;
|
|
|
|
out << "======== End CMake output ======\n";
|
2005-06-04 00:10:55 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void CMakeMessageCallback(const char* m, const char*, bool&, void* s)
|
|
|
|
{
|
|
|
|
std::string* out = (std::string*)s;
|
|
|
|
*out += m;
|
|
|
|
*out += "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void CMakeStdoutCallback(const char* m, int len, void* s)
|
|
|
|
{
|
|
|
|
std::string* out = (std::string*)s;
|
|
|
|
out->append(m, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
|
2006-03-09 19:17:10 +03:00
|
|
|
{
|
2005-06-04 00:10:55 +04:00
|
|
|
unsigned int k;
|
|
|
|
std::string cmakeOutString;
|
|
|
|
cmSystemTools::SetErrorCallback(CMakeMessageCallback, &cmakeOutString);
|
|
|
|
cmSystemTools::SetStdoutCallback(CMakeStdoutCallback, &cmakeOutString);
|
|
|
|
cmOStringStream out;
|
2006-03-10 23:03:09 +03:00
|
|
|
// What is this? double timeout = this->CTest->GetTimeOut();
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2005-06-04 00:10:55 +04:00
|
|
|
// if the generator and make program are not specified then it is an error
|
2006-03-10 23:03:09 +03:00
|
|
|
if (!this->BuildGenerator.size() || !this->BuildMakeProgram.size())
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
|
|
|
if(outstring)
|
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
*outstring =
|
2005-06-04 00:10:55 +04:00
|
|
|
"--build-and-test requires that both the generator and makeprogram "
|
|
|
|
"be provided using the --build-generator and --build-makeprogram "
|
|
|
|
"command line options. ";
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2005-06-04 00:10:55 +04:00
|
|
|
// make sure the binary dir is there
|
|
|
|
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
|
2006-03-10 23:03:09 +03:00
|
|
|
out << "Internal cmake changing into directory: "
|
|
|
|
<< this->BinaryDir << std::endl;
|
|
|
|
if (!cmSystemTools::FileIsDirectory(this->BinaryDir.c_str()))
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmSystemTools::MakeDirectory(this->BinaryDir.c_str());
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
cmSystemTools::ChangeDirectory(this->BinaryDir.c_str());
|
2005-06-04 00:10:55 +04:00
|
|
|
|
|
|
|
// should we cmake?
|
|
|
|
cmake cm;
|
2006-03-10 23:03:09 +03:00
|
|
|
cm.SetGlobalGenerator(cm.CreateGlobalGenerator(
|
|
|
|
this->BuildGenerator.c_str()));
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
if(!this->BuildNoCMake)
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
|
|
|
// do the cmake step
|
|
|
|
if (this->RunCMake(outstring,out,cmakeOutString,cwd,&cm))
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// do the build
|
2006-02-28 16:23:40 +03:00
|
|
|
std::vector<std::string>::iterator tarIt;
|
2006-03-10 23:03:09 +03:00
|
|
|
if ( this->BuildTargets.size() == 0 )
|
2006-02-28 16:23:40 +03:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BuildTargets.push_back("");
|
2006-02-28 16:23:40 +03:00
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
for ( tarIt = this->BuildTargets.begin(); tarIt != this->BuildTargets.end();
|
2006-02-28 16:23:40 +03:00
|
|
|
++ tarIt )
|
|
|
|
{
|
|
|
|
std::string output;
|
2006-03-23 23:35:03 +03:00
|
|
|
int retVal = cm.GetGlobalGenerator()->Build(
|
2006-03-10 23:03:09 +03:00
|
|
|
this->SourceDir.c_str(), this->BinaryDir.c_str(),
|
|
|
|
this->BuildProject.c_str(), tarIt->c_str(),
|
|
|
|
&output, this->BuildMakeProgram.c_str(),
|
2006-06-01 23:51:24 +04:00
|
|
|
this->CTest->GetConfigType().c_str(),!this->BuildNoClean, false);
|
2006-02-28 16:23:40 +03:00
|
|
|
|
|
|
|
out << output;
|
|
|
|
// if the build failed then return
|
|
|
|
if (retVal)
|
|
|
|
{
|
|
|
|
if(outstring)
|
|
|
|
{
|
|
|
|
*outstring = out.str();
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2005-06-04 00:10:55 +04:00
|
|
|
if(outstring)
|
|
|
|
{
|
|
|
|
*outstring = out.str();
|
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2005-06-04 00:10:55 +04:00
|
|
|
// if not test was specified then we are done
|
2006-03-10 23:03:09 +03:00
|
|
|
if (!this->TestCommand.size())
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2005-06-04 00:10:55 +04:00
|
|
|
// now run the compiled test if we can find it
|
|
|
|
std::vector<std::string> attempted;
|
|
|
|
std::vector<std::string> failed;
|
|
|
|
std::string tempPath;
|
2006-03-09 19:17:10 +03:00
|
|
|
std::string filepath =
|
2006-03-10 23:03:09 +03:00
|
|
|
cmSystemTools::GetFilenamePath(this->TestCommand);
|
2006-03-09 19:17:10 +03:00
|
|
|
std::string filename =
|
2006-03-10 23:03:09 +03:00
|
|
|
cmSystemTools::GetFilenameName(this->TestCommand);
|
2005-06-04 00:10:55 +04:00
|
|
|
// if full path specified then search that first
|
|
|
|
if (filepath.size())
|
|
|
|
{
|
|
|
|
tempPath = filepath;
|
|
|
|
tempPath += "/";
|
|
|
|
tempPath += filename;
|
|
|
|
attempted.push_back(tempPath);
|
2006-03-10 23:03:09 +03:00
|
|
|
if(this->CTest->GetConfigType().size())
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
|
|
|
tempPath = filepath;
|
|
|
|
tempPath += "/";
|
2006-03-10 23:03:09 +03:00
|
|
|
tempPath += this->CTest->GetConfigType();
|
2005-06-04 00:10:55 +04:00
|
|
|
tempPath += "/";
|
2005-12-19 19:29:57 +03:00
|
|
|
tempPath += filename;
|
|
|
|
attempted.push_back(tempPath);
|
|
|
|
// If the file is an OSX bundle then the configtyp
|
|
|
|
// will be at the start of the path
|
2006-03-10 23:03:09 +03:00
|
|
|
tempPath = this->CTest->GetConfigType();
|
2005-12-19 19:29:57 +03:00
|
|
|
tempPath += "/";
|
|
|
|
tempPath += filepath;
|
|
|
|
tempPath += "/";
|
2005-06-04 00:10:55 +04:00
|
|
|
tempPath += filename;
|
|
|
|
attempted.push_back(tempPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// otherwise search local dirs
|
|
|
|
else
|
|
|
|
{
|
|
|
|
attempted.push_back(filename);
|
2006-03-10 23:03:09 +03:00
|
|
|
if(this->CTest->GetConfigType().size())
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
tempPath = this->CTest->GetConfigType();
|
2005-06-04 00:10:55 +04:00
|
|
|
tempPath += "/";
|
|
|
|
tempPath += filename;
|
|
|
|
attempted.push_back(tempPath);
|
|
|
|
}
|
|
|
|
}
|
2006-03-10 23:03:09 +03:00
|
|
|
// if this->ExecutableDirectory is set try that as well
|
|
|
|
if (this->ExecutableDirectory.size())
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
tempPath = this->ExecutableDirectory;
|
2005-06-04 00:10:55 +04:00
|
|
|
tempPath += "/";
|
2006-03-10 23:03:09 +03:00
|
|
|
tempPath += this->TestCommand;
|
2005-06-04 00:10:55 +04:00
|
|
|
attempted.push_back(tempPath);
|
2006-03-10 23:03:09 +03:00
|
|
|
if(this->CTest->GetConfigType().size())
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
tempPath = this->ExecutableDirectory;
|
2005-06-04 00:10:55 +04:00
|
|
|
tempPath += "/";
|
2006-03-10 23:03:09 +03:00
|
|
|
tempPath += this->CTest->GetConfigType();
|
2005-06-04 00:10:55 +04:00
|
|
|
tempPath += "/";
|
|
|
|
tempPath += filename;
|
|
|
|
attempted.push_back(tempPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// store the final location in fullPath
|
|
|
|
std::string fullPath;
|
2006-03-09 19:17:10 +03:00
|
|
|
|
2005-06-04 00:10:55 +04:00
|
|
|
// now look in the paths we specified above
|
2006-03-09 19:17:10 +03:00
|
|
|
for(unsigned int ai=0;
|
2005-06-04 00:10:55 +04:00
|
|
|
ai < attempted.size() && fullPath.size() == 0; ++ai)
|
|
|
|
{
|
|
|
|
// first check without exe extension
|
|
|
|
if(cmSystemTools::FileExists(attempted[ai].c_str())
|
|
|
|
&& !cmSystemTools::FileIsDirectory(attempted[ai].c_str()))
|
|
|
|
{
|
|
|
|
fullPath = cmSystemTools::CollapseFullPath(attempted[ai].c_str());
|
|
|
|
}
|
|
|
|
// then try with the exe extension
|
|
|
|
else
|
|
|
|
{
|
|
|
|
failed.push_back(attempted[ai].c_str());
|
|
|
|
tempPath = attempted[ai];
|
|
|
|
tempPath += cmSystemTools::GetExecutableExtension();
|
|
|
|
if(cmSystemTools::FileExists(tempPath.c_str())
|
|
|
|
&& !cmSystemTools::FileIsDirectory(tempPath.c_str()))
|
|
|
|
{
|
|
|
|
fullPath = cmSystemTools::CollapseFullPath(tempPath.c_str());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
failed.push_back(tempPath.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!cmSystemTools::FileExists(fullPath.c_str()))
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
out << "Could not find path to executable, perhaps it was not built: "
|
|
|
|
<< this->TestCommand << "\n";
|
2005-06-04 00:10:55 +04:00
|
|
|
out << "tried to find it in these places:\n";
|
|
|
|
out << fullPath.c_str() << "\n";
|
|
|
|
for(unsigned int i=0; i < failed.size(); ++i)
|
|
|
|
{
|
|
|
|
out << failed[i] << "\n";
|
|
|
|
}
|
|
|
|
if(outstring)
|
|
|
|
{
|
|
|
|
*outstring = out.str();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE, out.str());
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
// return to the original directory
|
|
|
|
cmSystemTools::ChangeDirectory(cwd.c_str());
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<const char*> testCommand;
|
|
|
|
testCommand.push_back(fullPath.c_str());
|
2006-03-10 23:03:09 +03:00
|
|
|
for(k=0; k < this->TestCommandArgs.size(); ++k)
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
testCommand.push_back(this->TestCommandArgs[k].c_str());
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
testCommand.push_back(0);
|
|
|
|
std::string outs;
|
|
|
|
int retval = 0;
|
2006-03-10 23:03:09 +03:00
|
|
|
// run the test from the this->BuildRunDir if set
|
|
|
|
if(this->BuildRunDir.size())
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
out << "Run test in directory: " << this->BuildRunDir << "\n";
|
|
|
|
cmSystemTools::ChangeDirectory(this->BuildRunDir.c_str());
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
out << "Running test executable: " << fullPath << " ";
|
2006-03-10 23:03:09 +03:00
|
|
|
for(k=0; k < this->TestCommandArgs.size(); ++k)
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
out << this->TestCommandArgs[k] << " ";
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
out << "\n";
|
2006-03-10 23:03:09 +03:00
|
|
|
// What is this? this->TimeOut = timeout;
|
|
|
|
int runTestRes = this->CTest->RunTest(testCommand, &outs, &retval, 0);
|
2005-06-04 00:10:55 +04:00
|
|
|
if(runTestRes != cmsysProcess_State_Exited || retval != 0)
|
|
|
|
{
|
|
|
|
out << "Failed to run test command: " << testCommand[0] << "\n";
|
|
|
|
retval = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
out << outs << "\n";
|
|
|
|
if(outstring)
|
|
|
|
{
|
|
|
|
*outstring = out.str();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, OUTPUT, out.str() << std::endl);
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
|
|
|
|
const std::string& currentArg, size_t& idx,
|
|
|
|
const std::vector<std::string>& allArgs)
|
|
|
|
{
|
|
|
|
// --build-and-test options
|
|
|
|
if(currentArg.find("--build-and-test",0) == 0 && idx < allArgs.size() - 1)
|
|
|
|
{
|
|
|
|
if(idx+2 < allArgs.size())
|
|
|
|
{
|
|
|
|
idx++;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->SourceDir = allArgs[idx];
|
2005-06-04 00:10:55 +04:00
|
|
|
idx++;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BinaryDir = allArgs[idx];
|
2005-06-04 00:10:55 +04:00
|
|
|
// dir must exist before CollapseFullPath is called
|
2006-03-10 23:03:09 +03:00
|
|
|
cmSystemTools::MakeDirectory(this->BinaryDir.c_str());
|
|
|
|
this->BinaryDir
|
|
|
|
= cmSystemTools::CollapseFullPath(this->BinaryDir.c_str());
|
|
|
|
this->SourceDir
|
|
|
|
= cmSystemTools::CollapseFullPath(this->SourceDir.c_str());
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
2006-03-09 19:17:10 +03:00
|
|
|
"--build-and-test must have source and binary dir" << std::endl);
|
2005-06-04 00:10:55 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(currentArg.find("--build-target",0) == 0 && idx < allArgs.size() - 1)
|
|
|
|
{
|
|
|
|
idx++;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BuildTargets.push_back(allArgs[idx]);
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
if(currentArg.find("--build-nocmake",0) == 0)
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BuildNoCMake = true;
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
if(currentArg.find("--build-run-dir",0) == 0 && idx < allArgs.size() - 1)
|
|
|
|
{
|
|
|
|
idx++;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BuildRunDir = allArgs[idx];
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
if(currentArg.find("--build-two-config",0) == 0)
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BuildTwoConfig = true;
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
if(currentArg.find("--build-exe-dir",0) == 0 && idx < allArgs.size() - 1)
|
|
|
|
{
|
|
|
|
idx++;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->ExecutableDirectory = allArgs[idx];
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
if(currentArg.find("--build-generator",0) == 0 && idx < allArgs.size() - 1)
|
|
|
|
{
|
|
|
|
idx++;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BuildGenerator = allArgs[idx];
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
if(currentArg.find("--build-project",0) == 0 && idx < allArgs.size() - 1)
|
|
|
|
{
|
|
|
|
idx++;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BuildProject = allArgs[idx];
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
2006-03-09 19:17:10 +03:00
|
|
|
if(currentArg.find("--build-makeprogram",0) == 0 &&
|
|
|
|
idx < allArgs.size() - 1)
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
|
|
|
idx++;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BuildMakeProgram = allArgs[idx];
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
if(currentArg.find("--build-noclean",0) == 0)
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BuildNoClean = true;
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
if(currentArg.find("--build-options",0) == 0 && idx < allArgs.size() - 1)
|
|
|
|
{
|
|
|
|
++idx;
|
|
|
|
bool done = false;
|
|
|
|
while(idx < allArgs.size() && !done)
|
|
|
|
{
|
2006-03-10 23:03:09 +03:00
|
|
|
this->BuildOptions.push_back(allArgs[idx]);
|
2006-03-09 19:17:10 +03:00
|
|
|
if(idx+1 < allArgs.size()
|
|
|
|
&& (allArgs[idx+1] == "--build-target" ||
|
|
|
|
allArgs[idx+1] == "--test-command"))
|
2005-06-04 00:10:55 +04:00
|
|
|
{
|
|
|
|
done = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
++idx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(currentArg.find("--test-command",0) == 0 && idx < allArgs.size() - 1)
|
|
|
|
{
|
|
|
|
++idx;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->TestCommand = allArgs[idx];
|
2005-06-04 00:10:55 +04:00
|
|
|
while(idx+1 < allArgs.size())
|
|
|
|
{
|
|
|
|
++idx;
|
2006-03-10 23:03:09 +03:00
|
|
|
this->TestCommandArgs.push_back(allArgs[idx]);
|
2005-06-04 00:10:55 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|