Merge branch 'release-3.29'
[kiteware-cmake.git] / Source / cmTestGenerator.h
blob6903140ab150f657a924ca73e01eb23605bf49d6
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
5 #include "cmConfigure.h" // IWYU pragma: keep
7 #include <iosfwd>
8 #include <string>
9 #include <vector>
11 #include "cmScriptGenerator.h"
13 class cmGeneratorExpression;
14 class cmLocalGenerator;
15 class cmTest;
17 /** \class cmTestGenerator
18 * \brief Support class for generating install scripts.
21 class cmTestGenerator : public cmScriptGenerator
23 public:
24 cmTestGenerator(cmTest* test,
25 std::vector<std::string> const& configurations =
26 std::vector<std::string>());
27 ~cmTestGenerator() override;
29 cmTestGenerator(cmTestGenerator const&) = delete;
30 cmTestGenerator& operator=(cmTestGenerator const&) = delete;
32 void Compute(cmLocalGenerator* lg);
34 /** Test if this generator installs the test for a given configuration. */
35 bool TestsForConfig(const std::string& config);
37 cmTest* GetTest() const;
39 private:
40 void GenerateInternalProperties(std::ostream& os);
41 std::vector<std::string> EvaluateCommandLineArguments(
42 const std::vector<std::string>& argv, cmGeneratorExpression& ge,
43 const std::string& config) const;
45 protected:
46 void GenerateScriptConfigs(std::ostream& os, Indent indent) override;
47 void GenerateScriptActions(std::ostream& os, Indent indent) override;
48 void GenerateScriptForConfig(std::ostream& os, const std::string& config,
49 Indent indent) override;
50 void GenerateScriptNoConfig(std::ostream& os, Indent indent) override;
51 bool NeedsScriptNoConfig() const override;
52 void GenerateOldStyle(std::ostream& os, Indent indent);
54 cmLocalGenerator* LG;
55 cmTest* Test;
56 bool TestGenerated;