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 <map>
8 #include <memory>
9 #include <string>
10 
11 #include "cmGlobalVisualStudioGenerator.h"
12 #include "cmLocalGenerator.h"
13 
14 class cmCustomCommand;
15 class cmCustomCommandGenerator;
16 class cmGeneratorTarget;
17 class cmGlobalGenerator;
18 class cmMakefile;
19 class cmSourceFile;
20 
21 /** \class cmLocalVisualStudioGenerator
22  * \brief Base class for Visual Studio generators.
23  *
24  * cmLocalVisualStudioGenerator provides functionality common to all
25  * Visual Studio generators.
26  */
27 class cmLocalVisualStudioGenerator : public cmLocalGenerator
28 {
29 public:
30   cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
31   virtual ~cmLocalVisualStudioGenerator();
32 
33   /** Construct a script from the given list of command lines.  */
34   std::string ConstructScript(cmCustomCommandGenerator const& ccg,
35                               const std::string& newline = "\n");
36 
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 
41   cmGlobalVisualStudioGenerator::VSVersion GetVersion() const;
42 
43   virtual std::string ComputeLongestObjectDirectory(
44     cmGeneratorTarget const*) const = 0;
45 
46   void ComputeObjectFilenames(
47     std::map<cmSourceFile const*, std::string>& mapping,
48     cmGeneratorTarget const* = 0) override;
49 
50 protected:
51   virtual const char* ReportErrorLabel() const;
CustomCommandUseLocal()52   virtual bool CustomCommandUseLocal() const { return false; }
53 
54   /** Construct a custom command to make exe import lib dir.  */
55   std::unique_ptr<cmCustomCommand> MaybeCreateImplibDir(
56     cmGeneratorTarget* target, const std::string& config, bool isFortran);
57 };
58