cmLocalVisualStudioGenerator.h 1.9 KB

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