2016-09-27 15:01:08 -04:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2002-08-30 16:01:48 -04:00
|
|
|
#include "cmGlobalNMakeMakefileGenerator.h"
|
2016-04-29 09:40:20 -04:00
|
|
|
|
2016-11-05 21:40:14 +01:00
|
|
|
#include "cmDocumentationEntry.h"
|
2005-05-12 10:49:56 -04:00
|
|
|
#include "cmLocalUnixMakefileGenerator3.h"
|
2002-08-30 16:01:48 -04:00
|
|
|
#include "cmMakefile.h"
|
2016-10-18 21:28:49 +02:00
|
|
|
#include "cmState.h"
|
2002-08-30 16:01:48 -04:00
|
|
|
|
2015-05-24 11:31:14 +02:00
|
|
|
cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator(cmake* cm)
|
|
|
|
: cmGlobalUnixMakefileGenerator3(cm)
|
2002-12-05 13:44:11 -05:00
|
|
|
{
|
2006-03-15 11:02:08 -05:00
|
|
|
this->FindMakeProgramFile = "CMakeNMakeFindMake.cmake";
|
|
|
|
this->ForceUnixPaths = false;
|
2006-04-26 21:31:39 -04:00
|
|
|
this->ToolSupportsColor = true;
|
2006-06-15 16:17:11 -04:00
|
|
|
this->UseLinkScript = false;
|
2015-05-24 11:46:30 +02:00
|
|
|
cm->GetState()->SetWindowsShell(true);
|
|
|
|
cm->GetState()->SetNMake(true);
|
2015-05-16 05:20:36 +02:00
|
|
|
this->DefineWindowsNULL = true;
|
2015-05-16 05:20:58 +02:00
|
|
|
this->PassMakeflags = true;
|
2015-05-16 05:21:24 +02:00
|
|
|
this->UnixCD = false;
|
2015-05-16 05:23:06 +02:00
|
|
|
this->MakeSilentFlag = "/nologo";
|
2002-12-05 13:44:11 -05:00
|
|
|
}
|
|
|
|
|
2016-05-16 10:34:04 -04:00
|
|
|
void cmGlobalNMakeMakefileGenerator::EnableLanguage(
|
|
|
|
std::vector<std::string> const& l, cmMakefile* mf, bool optional)
|
2002-08-30 16:01:48 -04:00
|
|
|
{
|
2012-08-13 13:42:58 -04:00
|
|
|
// pick a default
|
2002-11-08 15:46:08 -05:00
|
|
|
mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
|
|
|
|
mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
|
2007-06-28 09:09:26 -04:00
|
|
|
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
|
2002-08-30 16:01:48 -04:00
|
|
|
}
|
|
|
|
|
2016-05-16 10:34:04 -04:00
|
|
|
void cmGlobalNMakeMakefileGenerator::GetDocumentation(
|
|
|
|
cmDocumentationEntry& entry)
|
2003-07-07 21:52:10 -04:00
|
|
|
{
|
2012-11-19 16:42:24 +01:00
|
|
|
entry.Name = cmGlobalNMakeMakefileGenerator::GetActualName();
|
2007-10-22 12:49:09 -04:00
|
|
|
entry.Brief = "Generates NMake makefiles.";
|
2003-07-07 21:52:10 -04:00
|
|
|
}
|
2015-08-05 21:23:07 +00:00
|
|
|
|
2016-05-16 10:34:04 -04:00
|
|
|
void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice(
|
|
|
|
std::ostream& os, std::string const& lang, const char* envVar) const
|
2015-08-05 21:23:07 +00:00
|
|
|
{
|
2016-05-16 10:34:04 -04:00
|
|
|
if (lang == "CXX" || lang == "C") {
|
2016-05-06 14:19:04 -04:00
|
|
|
/* clang-format off */
|
2015-08-05 21:23:07 +00:00
|
|
|
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";
|
2016-05-06 14:19:04 -04:00
|
|
|
/* clang-format on */
|
2016-05-16 10:34:04 -04:00
|
|
|
}
|
2015-08-05 21:23:07 +00:00
|
|
|
this->cmGlobalUnixMakefileGenerator3::PrintCompilerAdvice(os, lang, envVar);
|
|
|
|
}
|