Merge topic 'fix-build-crash-on-bad-generator'

44e2923f cmake: Fix --build crash on bad CMAKE_GENERATOR in cache
This commit is contained in:
Brad King 2014-06-04 09:18:46 -04:00 committed by CMake Topic Stage
commit 99d6fa0aa1
10 changed files with 21 additions and 1 deletions

View File

@ -2726,11 +2726,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"))

View File

@ -1,5 +1,12 @@
include(RunCMake)
run_cmake_command(build-no-cache
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR})
run_cmake_command(build-no-generator
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-no-generator)
run_cmake_command(build-bad-generator
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator)
if(UNIX)
run_cmake_command(E_create_symlink-missing-dir
${CMAKE_COMMAND} -E create_symlink T missing-dir/L

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
^Error: could create CMAKE_GENERATOR "Bad Generator"$

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
^Error: could not load cache$

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
^Error: could not find CMAKE_GENERATOR in Cache$

View File

@ -0,0 +1 @@
CMAKE_GENERATOR:INTERNAL=Bad Generator