cmGlobalNMakeMakefileGenerator.cxx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmGlobalNMakeMakefileGenerator.h"
  11. #include "cmLocalUnixMakefileGenerator3.h"
  12. #include "cmMakefile.h"
  13. cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator(cmake* cm)
  14. : cmGlobalUnixMakefileGenerator3(cm)
  15. {
  16. this->FindMakeProgramFile = "CMakeNMakeFindMake.cmake";
  17. this->ForceUnixPaths = false;
  18. this->ToolSupportsColor = true;
  19. this->UseLinkScript = false;
  20. cm->GetState()->SetWindowsShell(true);
  21. cm->GetState()->SetNMake(true);
  22. this->DefineWindowsNULL = true;
  23. this->PassMakeflags = true;
  24. this->UnixCD = false;
  25. this->MakeSilentFlag = "/nologo";
  26. }
  27. void cmGlobalNMakeMakefileGenerator
  28. ::EnableLanguage(std::vector<std::string>const& l,
  29. cmMakefile *mf,
  30. bool optional)
  31. {
  32. // pick a default
  33. mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
  34. mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
  35. this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
  36. }
  37. //----------------------------------------------------------------------------
  38. void cmGlobalNMakeMakefileGenerator
  39. ::GetDocumentation(cmDocumentationEntry& entry)
  40. {
  41. entry.Name = cmGlobalNMakeMakefileGenerator::GetActualName();
  42. entry.Brief = "Generates NMake makefiles.";
  43. }
  44. //----------------------------------------------------------------------------
  45. void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice(std::ostream& os,
  46. std::string const& lang,
  47. const char* envVar) const
  48. {
  49. if(lang == "CXX" || lang == "C")
  50. {
  51. /* clang-format off */
  52. os <<
  53. "To use the NMake generator with Visual C++, cmake must be run from a "
  54. "shell that can use the compiler cl from the command line. This "
  55. "environment is unable to invoke the cl compiler. To fix this problem, "
  56. "run cmake from the Visual Studio Command Prompt (vcvarsall.bat).\n";
  57. /* clang-format on */
  58. }
  59. this->cmGlobalUnixMakefileGenerator3::PrintCompilerAdvice(os, lang, envVar);
  60. }