resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmVisualStudioGeneratorOptions.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 <iosfwd>
8 #include <string>
9
10 #include "cmGlobalVisualStudioGenerator.h"
11 #include "cmIDEFlagTable.h"
12 #include "cmIDEOptions.h"
13
14 class cmLocalVisualStudioGenerator;
15
16 using cmVS7FlagTable = cmIDEFlagTable;
17
18 class cmVisualStudioGeneratorOptions : public cmIDEOptions
19 {
20 public:
21   // Construct an options table for a given tool.
22   enum Tool
23   {
24     Compiler,
25     ResourceCompiler,
26     CudaCompiler,
27     MasmCompiler,
28     NasmCompiler,
29     Linker,
30     FortranCompiler,
31     CSharpCompiler
32   };
33   cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg, Tool tool,
34                                  cmVS7FlagTable const* table = nullptr,
35                                  cmVS7FlagTable const* extraTable = nullptr);
36
37   // Add a table of flags.
38   void AddTable(cmVS7FlagTable const* table);
39
40   // Clear the flag tables.
41   void ClearTables();
42
43   // Store options from command line flags.
44   void Parse(const std::string& flags);
45   void ParseFinish();
46
47   void PrependInheritedString(std::string const& key);
48
49   // Parse the content of the given flag table entry again to extract
50   // known flags and leave the rest in the original entry.
51   void Reparse(std::string const& key);
52
53   // Fix the ExceptionHandling option to default to off.
54   void FixExceptionHandlingDefault();
55
56   // Store options for verbose builds.
57   void SetVerboseMakefile(bool verbose);
58
59   // Check for specific options.
60   bool UsingUnicode() const;
61   bool UsingSBCS() const;
62
63   void FixCudaCodeGeneration();
64
65   void FixManifestUACFlags();
66
67   bool IsDebug() const;
68   bool IsWinRt() const;
69   bool IsManaged() const;
70   // Write options to output.
71   void OutputPreprocessorDefinitions(std::ostream& fout, int indent,
72                                      const std::string& lang);
73   void OutputAdditionalIncludeDirectories(std::ostream& fout, int indent,
74                                           const std::string& lang);
75   void OutputFlagMap(std::ostream& fout, int indent);
76   void SetConfiguration(const std::string& config);
77   const std::string& GetConfiguration() const;
78
79 protected:
80   virtual void OutputFlag(std::ostream& fout, int indent,
81                           const std::string& tag,
82                           const std::string& content) = 0;
83
84 private:
85   cmLocalVisualStudioGenerator* LocalGenerator;
86   cmGlobalVisualStudioGenerator::VSVersion Version;
87
88   std::string Configuration;
89   Tool CurrentTool;
90
91   bool FortranRuntimeDebug;
92   bool FortranRuntimeDLL;
93   bool FortranRuntimeMT;
94
95   std::string UnknownFlagField;
96
97   void StoreUnknownFlag(std::string const& flag) override;
98
99   FlagValue TakeFlag(std::string const& key);
100 };