From 059a14a3a60b97000345de9057e6dd9b3627e617 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 25 Apr 2002 13:09:17 -0400 Subject: ENH: check for mismatched generators --- Source/cmake.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index b512d92..47f204c 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -408,6 +408,22 @@ int cmake::Generate(const std::vector& args, bool buildMakefiles) } cmMakefileGenerator* gen = mf.GetMakefileGenerator(); gen->SetLocal(m_Local); + const char* genName = mf.GetDefinition("CMAKE_GENERATOR"); + if(genName) + { + if(strcmp(gen->GetName(), genName) != 0) + { + std::string message = "Error: generator : "; + message += gen->GetName(); + message += "\nDoes not match the generator used previously: "; + message += genName; + message += + "\nEither remove the CMakeCache.txt file or choose a different" + " binary directory."; + cmSystemTools::Error(message.c_str()); + return -2; + } + } if(!mf.GetDefinition("CMAKE_GENERATOR")) { mf.AddCacheDefinition("CMAKE_GENERATOR", -- cgit v0.12