summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-06-03 15:36:25 (GMT)
committerBrad King <brad.king@kitware.com>2014-06-03 15:52:19 (GMT)
commit44e2923f332653f6b1aad610b314a9edbdf6bf24 (patch)
tree6cad08d769a4adb89287b0d0becb53d02e996076 /Source/cmake.cxx
parentcbc9a9514d0dd00b35b3de694dab02a387ec2b52 (diff)
downloadCMake-44e2923f332653f6b1aad610b314a9edbdf6bf24.zip
CMake-44e2923f332653f6b1aad610b314a9edbdf6bf24.tar.gz
CMake-44e2923f332653f6b1aad610b314a9edbdf6bf24.tar.bz2
cmake: Fix --build crash on bad CMAKE_GENERATOR in cache
If we fail to create the generator named by CMAKE_GENERATOR, exit with an error message instead of crashing. While at it, fix the wording of the error message when CMAKE_GENERATOR is not set. Extend the RunCMake.CommandLine test with cases covering the "cmake --build" option when the named directory does not provide a CMakeCache.txt with a valid CMAKE_GENERATOR.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index abbabe7..7297173 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2664,11 +2664,17 @@ int cmake::Build(const std::string& dir,
}
if(!it.Find("CMAKE_GENERATOR"))
{
- std::cerr << "Error: could find generator in Cache\n";
+ std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
return 1;
}
cmsys::auto_ptr<cmGlobalGenerator> gen(
this->CreateGlobalGenerator(it.GetValue()));
+ if(!gen.get())
+ {
+ std::cerr << "Error: could create CMAKE_GENERATOR \""
+ << it.GetValue() << "\"\n";
+ return 1;
+ }
std::string output;
std::string projName;
if(!it.Find("CMAKE_PROJECT_NAME"))