mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-05 07:10:26 +00:00
Refactor: Use unique_ptr instead of raw pointer
This commit is contained in:
@@ -600,9 +600,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
|
|||||||
|
|
||||||
const char* buildConfigCstr = this->GetOption("CPACK_BUILD_CONFIG");
|
const char* buildConfigCstr = this->GetOption("CPACK_BUILD_CONFIG");
|
||||||
std::string buildConfig = buildConfigCstr ? buildConfigCstr : "";
|
std::string buildConfig = buildConfigCstr ? buildConfigCstr : "";
|
||||||
cmGlobalGenerator* globalGenerator =
|
std::unique_ptr<cmGlobalGenerator> globalGenerator(
|
||||||
this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator(
|
this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator(
|
||||||
cmakeGenerator);
|
cmakeGenerator));
|
||||||
if (!globalGenerator) {
|
if (!globalGenerator) {
|
||||||
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
||||||
"Specified package generator not found. "
|
"Specified package generator not found. "
|
||||||
@@ -616,12 +616,10 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
|
|||||||
cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths());
|
cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths());
|
||||||
|
|
||||||
if (!this->RunPreinstallTarget(project.ProjectName, project.Directory,
|
if (!this->RunPreinstallTarget(project.ProjectName, project.Directory,
|
||||||
globalGenerator, buildConfig)) {
|
globalGenerator.get(), buildConfig)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete globalGenerator;
|
|
||||||
|
|
||||||
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||||
"- Install project: " << project.ProjectName << std::endl);
|
"- Install project: " << project.ProjectName << std::endl);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user