ENH: better error message for mis-configured nmake environment

This commit is contained in:
Bill Hoffman 2008-10-14 11:42:45 -04:00
parent 9b8d30081c
commit 9430c3f335
2 changed files with 17 additions and 1 deletions

View File

@ -29,7 +29,10 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 9")
# make sure to enable languages after setting configuration types
ENABLE_LANGUAGE(RC)
IF(NOT ENABLE_LANGUAGE_RC_CALLED AND NOT CMAKE_DO_TRY_COMPILE)
ENABLE_LANGUAGE(RC)
ENDIF(NOT ENABLE_LANGUAGE_RC_CALLED AND NOT CMAKE_DO_TRY_COMPILE)
SET(ENABLE_LANGUAGE_RC_CALLED TRUE)
SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
# for nmake we need to compute some information about the compiler

View File

@ -34,6 +34,19 @@ void cmGlobalNMakeMakefileGenerator
// pick a default
mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
if(!(cmSystemTools::GetEnv("INCLUDE") &&
cmSystemTools::GetEnv("LIB") &&
cmSystemTools::GetEnv("LIBPATH"))
)
{
std::string message = "To use the NMake generator, cmake must be run "
"from a shell that can use the compiler cl from the command line. "
"This environment does not contain INCLUDE, LIB, or LIBPATH, and "
"these must be set for the cl compiler to work. ";
mf->IssueMessage(cmake::WARNING,
message);
}
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
}