cmLocalVisualStudioGenerator.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <map>
  6. #include <memory>
  7. #include <string>
  8. #include "cmGlobalVisualStudioGenerator.h"
  9. #include "cmLocalGenerator.h"
  10. class cmCustomCommand;
  11. class cmCustomCommandGenerator;
  12. class cmGeneratorTarget;
  13. class cmGlobalGenerator;
  14. class cmMakefile;
  15. class cmSourceFile;
  16. /** \class cmLocalVisualStudioGenerator
  17. * \brief Base class for Visual Studio generators.
  18. *
  19. * cmLocalVisualStudioGenerator provides functionality common to all
  20. * Visual Studio generators.
  21. */
  22. class cmLocalVisualStudioGenerator : public cmLocalGenerator
  23. {
  24. public:
  25. cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
  26. virtual ~cmLocalVisualStudioGenerator();
  27. /** Construct a script from the given list of command lines. */
  28. enum class IsCSharp
  29. {
  30. No,
  31. Yes
  32. };
  33. std::string ConstructScript(cmCustomCommandGenerator const& ccg,
  34. const std::string& newline = "\n");
  35. std::string FinishConstructScript(IsCSharp isCSharp,
  36. const std::string& newline = "\n");
  37. /** Label to which to jump in a batch file after a failed step in a
  38. sequence of custom commands. */
  39. const char* GetReportErrorLabel() const;
  40. cmGlobalVisualStudioGenerator::VSVersion GetVersion() const;
  41. virtual std::string ComputeLongestObjectDirectory(
  42. cmGeneratorTarget const*) const = 0;
  43. void ComputeObjectFilenames(
  44. std::map<cmSourceFile const*, std::string>& mapping,
  45. cmGeneratorTarget const* = 0) override;
  46. protected:
  47. virtual const char* ReportErrorLabel() const;
  48. virtual bool CustomCommandUseLocal() const { return false; }
  49. /** Construct a custom command to make exe import lib dir. */
  50. std::unique_ptr<cmCustomCommand> MaybeCreateImplibDir(
  51. cmGeneratorTarget* target, const std::string& config, bool isFortran);
  52. };