From 9430c3f33591e1f9c4bb2d0d1b7fbd3486c3ff6e Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 14 Oct 2008 11:42:45 -0400 Subject: [PATCH] ENH: better error message for mis-configured nmake environment --- Modules/Platform/Windows-cl.cmake | 5 ++++- Source/cmGlobalNMakeMakefileGenerator.cxx | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index 562b2b02d..06169b094 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -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 /fo ") # for nmake we need to compute some information about the compiler diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 446881bf2..c35391604 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -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); }