summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestBuildCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-05-07 14:59:02 (GMT)
committerBrad King <brad.king@kitware.com>2014-05-07 15:02:16 (GMT)
commit54111286453894beb69ad18a9361edc2a50efc84 (patch)
tree2be66f856c661fde65c890374fa7ca3d5d660ed2 /Source/CTest/cmCTestBuildCommand.cxx
parent9cb4677509aa767245cbf4bb9e655d1559bc10bd (diff)
downloadCMake-54111286453894beb69ad18a9361edc2a50efc84.zip
CMake-54111286453894beb69ad18a9361edc2a50efc84.tar.gz
CMake-54111286453894beb69ad18a9361edc2a50efc84.tar.bz2
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 <malat@debian.org> Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=747306
Diffstat (limited to 'Source/CTest/cmCTestBuildCommand.cxx')
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index 12ff718..b250fc3 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)
{