summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2019-07-09 14:56:47 (GMT)
committerBrad King <brad.king@kitware.com>2019-08-19 19:25:06 (GMT)
commitd4e6b2ae25659699fccf6bc5888e87179f41b23a (patch)
treed31d55314cfc4186a3addd746de6cfc03ecc9ae4
parente3746821dfc37c8514c934e1e5d62d0ec99adc9f (diff)
downloadCMake-d4e6b2ae25659699fccf6bc5888e87179f41b23a.zip
CMake-d4e6b2ae25659699fccf6bc5888e87179f41b23a.tar.gz
CMake-d4e6b2ae25659699fccf6bc5888e87179f41b23a.tar.bz2
Refactor: Use `unique_ptr` instead of raw pointer
-rw-r--r--Source/CPack/cmCPackGenerator.cxx8
1 files changed, 3 insertions, 5 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index f3de53c..46c602e 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -600,9 +600,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
const char* buildConfigCstr = this->GetOption("CPACK_BUILD_CONFIG");
std::string buildConfig = buildConfigCstr ? buildConfigCstr : "";
- cmGlobalGenerator* globalGenerator =
+ std::unique_ptr<cmGlobalGenerator> globalGenerator(
this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator(
- cmakeGenerator);
+ cmakeGenerator));
if (!globalGenerator) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Specified package generator not found. "
@@ -616,12 +616,10 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths());
if (!this->RunPreinstallTarget(project.ProjectName, project.Directory,
- globalGenerator, buildConfig)) {
+ globalGenerator.get(), buildConfig)) {
return 0;
}
- delete globalGenerator;
-
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Install project: " << project.ProjectName << std::endl);