cmGlobalNMakeMakefileGenerator.cxx 1.88 KB
Newer Older
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
Ken Martin's avatar
Ken Martin committed
3
#include "cmGlobalNMakeMakefileGenerator.h"
4

5
#include "cmDocumentationEntry.h"
Ken Martin's avatar
Ken Martin committed
6
#include "cmLocalUnixMakefileGenerator3.h"
Ken Martin's avatar
Ken Martin committed
7
#include "cmMakefile.h"
8
#include "cmState.h"
Ken Martin's avatar
Ken Martin committed
9

10 11
cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator(cmake* cm)
  : cmGlobalUnixMakefileGenerator3(cm)
12
{
13 14
  this->FindMakeProgramFile = "CMakeNMakeFindMake.cmake";
  this->ForceUnixPaths = false;
15
  this->ToolSupportsColor = true;
16
  this->UseLinkScript = false;
17 18
  cm->GetState()->SetWindowsShell(true);
  cm->GetState()->SetNMake(true);
19
  this->DefineWindowsNULL = true;
20
  this->PassMakeflags = true;
21
  this->UnixCD = false;
22
  this->MakeSilentFlag = "/nologo";
23 24
}

25 26
void cmGlobalNMakeMakefileGenerator::EnableLanguage(
  std::vector<std::string> const& l, cmMakefile* mf, bool optional)
Ken Martin's avatar
Ken Martin committed
27
{
28
  // pick a default
29 30
  mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
  mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
31
  this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
Ken Martin's avatar
Ken Martin committed
32 33
}

34 35
void cmGlobalNMakeMakefileGenerator::GetDocumentation(
  cmDocumentationEntry& entry)
36
{
37
  entry.Name = cmGlobalNMakeMakefileGenerator::GetActualName();
38
  entry.Brief = "Generates NMake makefiles.";
39
}
40

41 42
void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice(
  std::ostream& os, std::string const& lang, const char* envVar) const
43
{
44
  if (lang == "CXX" || lang == "C") {
45
    /* clang-format off */
46 47 48 49 50
    os <<
      "To use the NMake generator with Visual C++, cmake must be run from a "
      "shell that can use the compiler cl from the command line. This "
      "environment is unable to invoke the cl compiler. To fix this problem, "
      "run cmake from the Visual Studio Command Prompt (vcvarsall.bat).\n";
51
    /* clang-format on */
52
  }
53 54
  this->cmGlobalUnixMakefileGenerator3::PrintCompilerAdvice(os, lang, envVar);
}