resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmGlobalNMakeMakefileGenerator.h
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 <iosfwd>
6 #include <memory>
7 #include <string>
8 #include <vector>
9
10 #include "cm_codecvt.hxx"
11
12 #include "cmGlobalGeneratorFactory.h"
13 #include "cmGlobalUnixMakefileGenerator3.h"
14 #include "cmValue.h"
15
16 class cmMakefile;
17 class cmake;
18 struct cmDocumentationEntry;
19
20 /** \class cmGlobalNMakeMakefileGenerator
21  * \brief Write a NMake makefiles.
22  *
23  * cmGlobalNMakeMakefileGenerator manages nmake build process for a tree
24  */
25 class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3
26 {
27 public:
28   cmGlobalNMakeMakefileGenerator(cmake* cm);
29   static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory()
30   {
31     return std::unique_ptr<cmGlobalGeneratorFactory>(
32       new cmGlobalGeneratorSimpleFactory<cmGlobalNMakeMakefileGenerator>());
33   }
34   //! Get the name for the generator.
35   std::string GetName() const override
36   {
37     return cmGlobalNMakeMakefileGenerator::GetActualName();
38   }
39   static std::string GetActualName() { return "NMake Makefiles"; }
40
41   /** Get encoding used by generator for makefile files */
42   codecvt::Encoding GetMakefileEncoding() const override
43   {
44     return this->NMakeSupportsUTF8 ? codecvt::UTF8_WITH_BOM : codecvt::ANSI;
45   }
46
47   /** Get the documentation entry for this generator.  */
48   static void GetDocumentation(cmDocumentationEntry& entry);
49
50   /**
51    * Try to determine system information such as shared library
52    * extension, pthreads, byte order etc.
53    */
54   void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
55                       bool optional) override;
56
57 protected:
58   std::vector<GeneratedMakeCommand> GenerateBuildCommand(
59     const std::string& makeProgram, const std::string& projectName,
60     const std::string& projectDir, std::vector<std::string> const& targetNames,
61     const std::string& config, int jobs, bool verbose,
62     const cmBuildOptions& buildOptions = cmBuildOptions(),
63     std::vector<std::string> const& makeOptions =
64       std::vector<std::string>()) override;
65
66   void PrintBuildCommandAdvice(std::ostream& os, int jobs) const override;
67
68 private:
69   bool NMakeSupportsUTF8 = false;
70   std::string NMakeVersion;
71   bool FindMakeProgram(cmMakefile* mf) override;
72   void CheckNMakeFeatures();
73
74   void PrintCompilerAdvice(std::ostream& os, std::string const& lang,
75                            cmValue envVar) const override;
76 };