Coverage Report

Created: 2026-03-12 06:35

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