cmVisualStudioGeneratorOptions.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmVisualStudioGeneratorOptions_h
  14. #define cmVisualStudioGeneratorOptions_h
  15. #include "cmLocalGenerator.h"
  16. #include "cmIDEFlagTable.h"
  17. typedef cmIDEFlagTable cmVS7FlagTable;
  18. class cmVisualStudio10TargetGenerator;
  19. //----------------------------------------------------------------------------
  20. class cmVisualStudioGeneratorOptions
  21. {
  22. public:
  23. // Construct an options table for a given tool.
  24. enum Tool
  25. {
  26. Compiler,
  27. Linker,
  28. FortranCompiler
  29. };
  30. cmVisualStudioGeneratorOptions(cmLocalGenerator* lg,
  31. int version,
  32. Tool tool,
  33. cmVS7FlagTable const* table,
  34. cmVS7FlagTable const* extraTable = 0,
  35. cmVisualStudio10TargetGenerator* g = 0);
  36. // Store options from command line flags.
  37. void Parse(const char* flags);
  38. // Fix the ExceptionHandling option to default to off.
  39. void FixExceptionHandlingDefault();
  40. // Store options for verbose builds.
  41. void SetVerboseMakefile(bool verbose);
  42. // Store definitions and flags.
  43. void AddDefine(const std::string& define);
  44. void AddDefines(const char* defines);
  45. void AddFlag(const char* flag, const char* value);
  46. // Check for specific options.
  47. bool UsingUnicode();
  48. bool IsDebug();
  49. // Write options to output.
  50. void OutputPreprocessorDefinitions(std::ostream& fout,
  51. const char* prefix,
  52. const char* suffix);
  53. void OutputFlagMap(std::ostream& fout, const char* indent);
  54. void OutputAdditionalOptions(std::ostream& fout,
  55. const char* prefix,
  56. const char* suffix);
  57. void SetConfiguration(const char* config);
  58. private:
  59. cmLocalGenerator* LocalGenerator;
  60. int Version;
  61. // create a map of xml tags to the values they should have in the output
  62. // for example, "BufferSecurityCheck" = "TRUE"
  63. // first fill this table with the values for the configuration
  64. // Debug, Release, etc,
  65. // Then parse the command line flags specified in CMAKE_CXX_FLAGS
  66. // and CMAKE_C_FLAGS
  67. // and overwrite or add new values to this map
  68. std::map<cmStdString, cmStdString> FlagMap;
  69. // Preprocessor definitions.
  70. std::vector<std::string> Defines;
  71. // Unrecognized flags that get no special handling.
  72. cmStdString FlagString;
  73. std::string Configuration;
  74. cmVisualStudio10TargetGenerator* TargetGenerator;
  75. Tool CurrentTool;
  76. bool DoingDefine;
  77. cmVS7FlagTable const* FlagTable;
  78. cmVS7FlagTable const* ExtraFlagTable;
  79. void HandleFlag(const char* flag);
  80. bool CheckFlagTable(cmVS7FlagTable const* table, const char* flag,
  81. bool& flag_handled);
  82. };
  83. #endif