756952d8ec6c182c1ad201e11594f90f6ca170c0
[platform/upstream/cmake.git] / Source / CTest / cmCTestHandlerCommand.h
1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    file Copyright.txt or https://cmake.org/licensing for details.  */
3 #pragma once
4
5 #include "cmConfigure.h" // IWYU pragma: keep
6
7 #include <string>
8 #include <vector>
9
10 #include "cmArgumentParser.h"
11 #include "cmCTestCommand.h"
12
13 class cmCTestGenericHandler;
14 class cmExecutionStatus;
15
16 /** \class cmCTestHandler
17  * \brief Run a ctest script
18  *
19  * cmCTestHandlerCommand defineds the command to test the project.
20  */
21 class cmCTestHandlerCommand
22   : public cmCTestCommand
23   , public cmArgumentParser<void>
24 {
25 public:
26   /**
27    * The name of the command as specified in CMakeList.txt.
28    */
29   virtual std::string GetName() const = 0;
30
31   /**
32    * This is called when the command is first encountered in
33    * the CMakeLists.txt file.
34    */
35   bool InitialPass(std::vector<std::string> const& args,
36                    cmExecutionStatus& status) override;
37
38 protected:
39   virtual cmCTestGenericHandler* InitializeHandler() = 0;
40
41   virtual void ProcessAdditionalValues(cmCTestGenericHandler* handler);
42
43   // Command argument handling.
44   virtual void BindArguments();
45   virtual void CheckArguments(std::vector<std::string> const& keywords);
46
47   bool Append = false;
48   bool Quiet = false;
49   std::string CaptureCMakeError;
50   std::string ReturnValue;
51   std::string Build;
52   std::string Source;
53   std::string SubmitIndex;
54 };
55
56 #define CTEST_COMMAND_APPEND_OPTION_DOCS                                      \
57   "The APPEND option marks results for append to those previously "           \
58   "submitted to a dashboard server since the last ctest_start.  "             \
59   "Append semantics are defined by the dashboard server in use."