cmGlobalNMakeMakefileGenerator.cxx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 "cmGlobalNMakeMakefileGenerator.h"
  4. #include "cmDocumentationEntry.h"
  5. #include "cmLocalUnixMakefileGenerator3.h"
  6. #include "cmMakefile.h"
  7. #include "cmState.h"
  8. cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator(cmake* cm)
  9. : cmGlobalUnixMakefileGenerator3(cm)
  10. {
  11. this->FindMakeProgramFile = "CMakeNMakeFindMake.cmake";
  12. this->ForceUnixPaths = false;
  13. this->ToolSupportsColor = true;
  14. this->UseLinkScript = false;
  15. cm->GetState()->SetWindowsShell(true);
  16. cm->GetState()->SetNMake(true);
  17. this->DefineWindowsNULL = true;
  18. this->PassMakeflags = true;
  19. this->UnixCD = false;
  20. this->MakeSilentFlag = "/nologo";
  21. }
  22. void cmGlobalNMakeMakefileGenerator::EnableLanguage(
  23. std::vector<std::string> const& l, cmMakefile* mf, bool optional)
  24. {
  25. // pick a default
  26. mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
  27. mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
  28. this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
  29. }
  30. void cmGlobalNMakeMakefileGenerator::GetDocumentation(
  31. cmDocumentationEntry& entry)
  32. {
  33. entry.Name = cmGlobalNMakeMakefileGenerator::GetActualName();
  34. entry.Brief = "Generates NMake makefiles.";
  35. }
  36. void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice(
  37. std::ostream& os, std::string const& lang, const char* envVar) const
  38. {
  39. if (lang == "CXX" || lang == "C") {
  40. /* clang-format off */
  41. os <<
  42. "To use the NMake generator with Visual C++, cmake must be run from a "
  43. "shell that can use the compiler cl from the command line. This "
  44. "environment is unable to invoke the cl compiler. To fix this problem, "
  45. "run cmake from the Visual Studio Command Prompt (vcvarsall.bat).\n";
  46. /* clang-format on */
  47. }
  48. this->cmGlobalUnixMakefileGenerator3::PrintCompilerAdvice(os, lang, envVar);
  49. }