cmGlobalNMakeMakefileGenerator.cxx 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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()
  14. {
  15. this->FindMakeProgramFile = "CMakeNMakeFindMake.cmake";
  16. this->ForceUnixPaths = false;
  17. this->ToolSupportsColor = true;
  18. this->UseLinkScript = false;
  19. }
  20. void cmGlobalNMakeMakefileGenerator
  21. ::EnableLanguage(std::vector<std::string>const& l,
  22. cmMakefile *mf,
  23. bool optional)
  24. {
  25. // pick a default
  26. mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
  27. mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
  28. if(!(cmSystemTools::GetEnv("INCLUDE") &&
  29. cmSystemTools::GetEnv("LIB"))
  30. )
  31. {
  32. std::string message = "To use the NMake generator, cmake must be run "
  33. "from a shell that can use the compiler cl from the command line. "
  34. "This environment does not contain INCLUDE, LIB, or LIBPATH, and "
  35. "these must be set for the cl compiler to work. ";
  36. mf->IssueMessage(cmake::WARNING,
  37. message);
  38. }
  39. this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
  40. }
  41. ///! Create a local generator appropriate to this Global Generator
  42. cmLocalGenerator *
  43. cmGlobalNMakeMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
  44. {
  45. cmLocalUnixMakefileGenerator3* lg =
  46. new cmLocalUnixMakefileGenerator3(parent);
  47. lg->SetDefineWindowsNULL(true);
  48. lg->SetWindowsShell(true);
  49. lg->SetMakeSilentFlag("/nologo");
  50. lg->SetGlobalGenerator(this);
  51. lg->SetIgnoreLibPrefix(true);
  52. lg->SetPassMakeflags(true);
  53. lg->SetNMake(true);
  54. lg->SetUnixCD(false);
  55. return lg;
  56. }
  57. //----------------------------------------------------------------------------
  58. void cmGlobalNMakeMakefileGenerator
  59. ::GetDocumentation(cmDocumentationEntry& entry)
  60. {
  61. entry.Name = cmGlobalNMakeMakefileGenerator::GetActualName();
  62. entry.Brief = "Generates NMake makefiles.";
  63. }