Imported Upstream version 2.8.11.2
[platform/upstream/cmake.git] / Source / cmGlobalNMakeMakefileGenerator.cxx
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #include "cmGlobalNMakeMakefileGenerator.h"
13 #include "cmLocalUnixMakefileGenerator3.h"
14 #include "cmMakefile.h"
15
16 cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator()
17 {
18   this->FindMakeProgramFile = "CMakeNMakeFindMake.cmake";
19   this->ForceUnixPaths = false;
20   this->ToolSupportsColor = true;
21   this->UseLinkScript = false;
22 }
23
24 void cmGlobalNMakeMakefileGenerator
25 ::EnableLanguage(std::vector<std::string>const& l,
26                  cmMakefile *mf,
27                  bool optional)
28 {
29   // pick a default
30   mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
31   mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
32   if(!(cmSystemTools::GetEnv("INCLUDE") &&
33        cmSystemTools::GetEnv("LIB"))
34     )
35     {
36     std::string message = "To use the NMake generator, cmake must be run "
37       "from a shell that can use the compiler cl from the command line. "
38       "This environment does not contain INCLUDE, LIB, or LIBPATH, and "
39       "these must be set for the cl compiler to work. ";
40     mf->IssueMessage(cmake::WARNING,
41                      message);
42     }
43
44   this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
45 }
46
47 ///! Create a local generator appropriate to this Global Generator
48 cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
49 {
50   cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
51   lg->SetDefineWindowsNULL(true);
52   lg->SetWindowsShell(true);
53   lg->SetMakeSilentFlag("/nologo");
54   lg->SetGlobalGenerator(this);
55   lg->SetIgnoreLibPrefix(true);
56   lg->SetPassMakeflags(true);
57   lg->SetNMake(true);
58   lg->SetUnixCD(false);
59   return lg;
60 }
61
62 //----------------------------------------------------------------------------
63 void cmGlobalNMakeMakefileGenerator
64 ::GetDocumentation(cmDocumentationEntry& entry)
65 {
66   entry.Name = cmGlobalNMakeMakefileGenerator::GetActualName();
67   entry.Brief = "Generates NMake makefiles.";
68   entry.Full = "";
69 }