cmVisualStudioGeneratorOptions.h 2.92 KB
Newer Older
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
3 4 5
#ifndef cmVisualStudioGeneratorOptions_h
#define cmVisualStudioGeneratorOptions_h

6
#include "cmConfigure.h" // IWYU pragma: keep
7

8 9 10 11 12
#include <iosfwd>
#include <string>

#include "cmGlobalVisualStudioGenerator.h"
#include "cmIDEFlagTable.h"
13
#include "cmIDEOptions.h"
14 15 16

class cmLocalVisualStudioGenerator;

17 18
typedef cmIDEFlagTable cmVS7FlagTable;

19
class cmVisualStudioGeneratorOptions : public cmIDEOptions
20 21 22 23 24 25
{
public:
  // Construct an options table for a given tool.
  enum Tool
  {
    Compiler,
26
    ResourceCompiler,
27
    CudaCompiler,
28
    MasmCompiler,
29
    NasmCompiler,
30
    Linker,
31 32
    FortranCompiler,
    CSharpCompiler
33
  };
34
  cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg, Tool tool,
35 36
                                 cmVS7FlagTable const* table = nullptr,
                                 cmVS7FlagTable const* extraTable = nullptr);
37 38 39 40

  // Add a table of flags.
  void AddTable(cmVS7FlagTable const* table);

41 42 43
  // Clear the flag tables.
  void ClearTables();

44
  // Store options from command line flags.
45
  void Parse(const std::string& flags);
46
  void ParseFinish();
47

48 49
  void PrependInheritedString(std::string const& key);

50 51 52 53
  // Parse the content of the given flag table entry again to extract
  // known flags and leave the rest in the original entry.
  void Reparse(std::string const& key);

54 55 56 57 58 59 60
  // Fix the ExceptionHandling option to default to off.
  void FixExceptionHandlingDefault();

  // Store options for verbose builds.
  void SetVerboseMakefile(bool verbose);

  // Check for specific options.
61 62
  bool UsingUnicode() const;
  bool UsingSBCS() const;
63

64 65 66 67 68 69 70 71
  enum CudaRuntime
  {
    CudaRuntimeStatic,
    CudaRuntimeShared,
    CudaRuntimeNone
  };
  CudaRuntime GetCudaRuntime() const;

72 73
  void FixCudaCodeGeneration();

74 75
  void FixManifestUACFlags();

76
  bool IsDebug() const;
77
  bool IsWinRt() const;
78
  bool IsManaged() const;
79
  // Write options to output.
80
  void OutputPreprocessorDefinitions(std::ostream& fout, int indent,
81
                                     const std::string& lang);
82
  void OutputAdditionalIncludeDirectories(std::ostream& fout, int indent,
83
                                          const std::string& lang);
84
  void OutputFlagMap(std::ostream& fout, int indent);
85
  void SetConfiguration(const std::string& config);
86
  const std::string& GetConfiguration() const;
87

88
protected:
89 90
  virtual void OutputFlag(std::ostream& fout, int indent, const char* tag,
                          const std::string& content) = 0;
91

92
private:
93
  cmLocalVisualStudioGenerator* LocalGenerator;
94
  cmGlobalVisualStudioGenerator::VSVersion Version;
95 96 97

  std::string Configuration;
  Tool CurrentTool;
98

99 100 101 102
  bool FortranRuntimeDebug;
  bool FortranRuntimeDLL;
  bool FortranRuntimeMT;

103 104
  std::string UnknownFlagField;

105
  void StoreUnknownFlag(std::string const& flag) override;
106 107

  FlagValue TakeFlag(std::string const& key);
108 109 110
};

#endif