resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmGlobalWatcomWMakeGenerator.cxx
1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    file Copyright.txt or https://cmake.org/licensing for details.  */
3 #include "cmGlobalWatcomWMakeGenerator.h"
4
5 #include <ostream>
6
7 #include "cmDocumentationEntry.h"
8 #include "cmGlobalGenerator.h"
9 #include "cmMakefile.h"
10 #include "cmState.h"
11 #include "cmake.h"
12
13 cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)
14   : cmGlobalUnixMakefileGenerator3(cm)
15 {
16   this->FindMakeProgramFile = "CMakeFindWMake.cmake";
17 #ifdef _WIN32
18   this->ForceUnixPaths = false;
19 #endif
20   this->ToolSupportsColor = true;
21   this->NeedSymbolicMark = true;
22   this->EmptyRuleHackCommand = "@%null";
23 #ifdef _WIN32
24   cm->GetState()->SetWindowsShell(true);
25 #endif
26   cm->GetState()->SetWatcomWMake(true);
27   this->IncludeDirective = "!include";
28   this->LineContinueDirective = "&\n";
29   this->DefineWindowsNULL = true;
30   this->UnixCD = false;
31   this->MakeSilentFlag = "-h";
32 }
33
34 void cmGlobalWatcomWMakeGenerator::EnableLanguage(
35   std::vector<std::string> const& l, cmMakefile* mf, bool optional)
36 {
37   // pick a default
38   mf->AddDefinition("WATCOM", "1");
39   mf->AddDefinition("CMAKE_QUOTE_INCLUDE_PATHS", "1");
40   mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1");
41   mf->AddDefinition("CMAKE_MAKE_SYMBOLIC_RULE", ".SYMBOLIC");
42   mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl386");
43   mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl386");
44   this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
45 }
46
47 bool cmGlobalWatcomWMakeGenerator::SetSystemName(std::string const& s,
48                                                  cmMakefile* mf)
49 {
50   if (mf->GetSafeDefinition("CMAKE_SYSTEM_PROCESSOR") == "I86") {
51     mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl");
52     mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl");
53   }
54   return this->cmGlobalUnixMakefileGenerator3::SetSystemName(s, mf);
55 }
56
57 void cmGlobalWatcomWMakeGenerator::GetDocumentation(
58   cmDocumentationEntry& entry)
59 {
60   entry.Name = cmGlobalWatcomWMakeGenerator::GetActualName();
61   entry.Brief = "Generates Watcom WMake makefiles.";
62 }
63
64 std::vector<cmGlobalGenerator::GeneratedMakeCommand>
65 cmGlobalWatcomWMakeGenerator::GenerateBuildCommand(
66   const std::string& makeProgram, const std::string& projectName,
67   const std::string& projectDir, std::vector<std::string> const& targetNames,
68   const std::string& config, int /*jobs*/, bool verbose,
69   const cmBuildOptions& buildOptions,
70   std::vector<std::string> const& makeOptions)
71 {
72   return this->cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
73     makeProgram, projectName, projectDir, targetNames, config,
74     cmake::NO_BUILD_PARALLEL_LEVEL, verbose, buildOptions, makeOptions);
75 }
76
77 void cmGlobalWatcomWMakeGenerator::PrintBuildCommandAdvice(std::ostream& os,
78                                                            int jobs) const
79 {
80   if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
81     // wmake does not support parallel build level
82
83     /* clang-format off */
84     os <<
85       "Warning: Watcom's WMake does not support parallel builds. "
86       "Ignoring parallel build command line option.\n";
87     /* clang-format on */
88   }
89
90   this->cmGlobalUnixMakefileGenerator3::PrintBuildCommandAdvice(
91     os, cmake::NO_BUILD_PARALLEL_LEVEL);
92 }