cmCPackGenerator: Avoid crash on undefined CMAKE_MAKE_PROGRAM

Since commit 6557382d (stringapi: Use strings for program
paths, 2014-02-24), cmGlobalGenerator::GenerateBuildCommand
takes the make program path as a std::string.  Fix the lookup
in cmCPackGenerator::InstallProjectViaInstallCMakeProjects to
use GetSafeDefinition for CMAKE_MAKE_PROGRAM to avoid possible
construction of std::string from a NULL.

Reported-by: Richard Wirth <richard@califax.de>
This commit is contained in:
Brad King 2014-06-25 09:13:53 -04:00
parent c491cb1eb4
commit 3bae343f62
1 changed files with 2 additions and 2 deletions

View File

@ -637,8 +637,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
if ( globalGenerator->GetPreinstallTargetName() )
{
globalGenerator->FindMakeProgram(this->MakefileMap);
const char* cmakeMakeProgram
= this->MakefileMap->GetDefinition("CMAKE_MAKE_PROGRAM");
std::string cmakeMakeProgram
= this->MakefileMap->GetSafeDefinition("CMAKE_MAKE_PROGRAM");
std::vector<std::string> buildCommand;
globalGenerator->GenerateBuildCommand(buildCommand, cmakeMakeProgram,
installProjectName, installDirectory,