1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCTestStartCommand.cxx,v $
6 Date: $Date: 2008-01-23 15:28:01 $
7 Version: $Revision: 1.16 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmCTestStartCommand.h"
20 #include "cmLocalGenerator.h"
21 #include "cmGlobalGenerator.h"
23 bool cmCTestStartCommand
24 ::InitialPass(std::vector
<std::string
> const& args
, cmExecutionStatus
&)
28 this->SetError("called with incorrect number of arguments");
33 const char* smodel
= args
[cnt
].c_str();
34 const char* src_dir
= 0;
35 const char* bld_dir
= 0;
39 this->CTest
->SetSpecificTrack(0);
40 if ( cnt
< args
.size() -1 )
42 if ( args
[cnt
] == "TRACK" )
45 this->CTest
->SetSpecificTrack(args
[cnt
].c_str());
50 if ( cnt
< args
.size() )
52 src_dir
= args
[cnt
].c_str();
54 if ( cnt
< args
.size() )
56 bld_dir
= args
[cnt
].c_str();
61 src_dir
= this->Makefile
->GetDefinition("CTEST_SOURCE_DIRECTORY");
65 bld_dir
= this->Makefile
->GetDefinition("CTEST_BINARY_DIRECTORY");
69 this->SetError("source directory not specified. Specify source directory "
70 "as an argument or set CTEST_SOURCE_DIRECTORY");
75 this->SetError("binary directory not specified. Specify binary directory "
76 "as an argument or set CTEST_BINARY_DIRECTORY");
80 cmSystemTools::AddKeepPath(src_dir
);
81 cmSystemTools::AddKeepPath(bld_dir
);
83 this->CTest
->EmptyCTestConfiguration();
84 this->CTest
->SetCTestConfiguration("SourceDirectory",
85 cmSystemTools::CollapseFullPath(src_dir
).c_str());
86 this->CTest
->SetCTestConfiguration("BuildDirectory",
87 cmSystemTools::CollapseFullPath(bld_dir
).c_str());
89 cmCTestLog(this->CTest
, HANDLER_OUTPUT
, "Run dashboard with model "
90 << smodel
<< std::endl
91 << " Source directory: " << src_dir
<< std::endl
92 << " Build directory: " << bld_dir
<< std::endl
);
93 const char* track
= this->CTest
->GetSpecificTrack();
96 cmCTestLog(this->CTest
, HANDLER_OUTPUT
,
97 " Track: " << track
<< std::endl
);
100 this->Makefile
->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", "OFF");
101 this->CTest
->SetSuppressUpdatingCTestConfiguration(true);
102 int model
= this->CTest
->GetTestModelFromString(smodel
);
103 this->CTest
->SetTestModel(model
);
104 this->CTest
->SetProduceXML(true);
106 return this->CTest
->InitializeFromCommand(this, true);