From 54111286453894beb69ad18a9361edc2a50efc84 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 7 May 2014 10:59:02 -0400 Subject: ctest_build: Do not crash on bad generator name If creation of the global generator fails, return early with an error message instead of trying to use the generator and crashing. Add a CTestTestBadGenerator test to cover this case. Reported-by: Mathieu Malaterre Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=747306 --- Source/CTest/cmCTestBuildCommand.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Source/CTest') diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 12ff71828a..b250fc329a 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -113,6 +113,15 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() this->GlobalGenerator = this->Makefile->GetCMakeInstance()->CreateGlobalGenerator( cmakeGeneratorName); + if(!this->GlobalGenerator) + { + std::string e = "could not create generator named \""; + e += cmakeGeneratorName; + e += "\""; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e); + cmSystemTools::SetFatalErrorOccured(); + return 0; + } } if(strlen(cmakeBuildConfiguration) == 0) { -- cgit v1.2.1