diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:20:25 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:20:25 +0900 |
commit | 50e508f0913d5580aa156327527da3d29a66b90c (patch) | |
tree | d581ffbad59a2becc33bc79e75e504de500a8e93 /Source/CPack/cpack.cxx | |
parent | 37869418c616f7e57c34b9287c4c8f3671df20de (diff) | |
download | cmake-50e508f0913d5580aa156327527da3d29a66b90c.tar.gz cmake-50e508f0913d5580aa156327527da3d29a66b90c.tar.bz2 cmake-50e508f0913d5580aa156327527da3d29a66b90c.zip |
Imported Upstream version 3.19.0upstream/3.19.0
Diffstat (limited to 'Source/CPack/cpack.cxx')
-rw-r--r-- | Source/CPack/cpack.cxx | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index cc1ddf509..85c13ada7 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -22,6 +22,7 @@ #include "cmDocumentationFormatter.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmState.h" #include "cmStateSnapshot.h" #include "cmStringAlgorithms.h" @@ -319,21 +320,22 @@ int main(int argc, char const* const* argv) } // Force CPACK_PACKAGE_DIRECTORY as absolute path - cpackProjectDirectory = globalMF.GetDefinition("CPACK_PACKAGE_DIRECTORY"); + cpackProjectDirectory = + globalMF.GetSafeDefinition("CPACK_PACKAGE_DIRECTORY"); cpackProjectDirectory = cmSystemTools::CollapseFullPath(cpackProjectDirectory); globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY", cpackProjectDirectory); - const char* cpackModulesPath = globalMF.GetDefinition("CPACK_MODULE_PATH"); + cmProp cpackModulesPath = globalMF.GetDefinition("CPACK_MODULE_PATH"); if (cpackModulesPath) { - globalMF.AddDefinition("CMAKE_MODULE_PATH", cpackModulesPath); + globalMF.AddDefinition("CMAKE_MODULE_PATH", *cpackModulesPath); } - const char* genList = globalMF.GetDefinition("CPACK_GENERATOR"); + cmProp genList = globalMF.GetDefinition("CPACK_GENERATOR"); if (!genList) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "CPack generator not specified" << std::endl); } else { - std::vector<std::string> generatorsVector = cmExpandedList(genList); + std::vector<std::string> generatorsVector = cmExpandedList(*genList); for (std::string const& gen : generatorsVector) { cmMakefile::ScopePushPop raii(&globalMF); cmMakefile* mf = &globalMF; @@ -406,32 +408,31 @@ int main(int argc, char const* const* argv) parsed = 0; } if (parsed) { - const char* projName = mf->GetDefinition("CPACK_PACKAGE_NAME"); + cmProp projName = mf->GetDefinition("CPACK_PACKAGE_NAME"); cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Use generator: " << cpackGenerator->GetNameOfClass() << std::endl); cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, - "For project: " << projName << std::endl); + "For project: " << *projName << std::endl); - const char* projVersion = - mf->GetDefinition("CPACK_PACKAGE_VERSION"); + cmProp projVersion = mf->GetDefinition("CPACK_PACKAGE_VERSION"); if (!projVersion) { - const char* projVersionMajor = + cmProp projVersionMajor = mf->GetDefinition("CPACK_PACKAGE_VERSION_MAJOR"); - const char* projVersionMinor = + cmProp projVersionMinor = mf->GetDefinition("CPACK_PACKAGE_VERSION_MINOR"); - const char* projVersionPatch = + cmProp projVersionPatch = mf->GetDefinition("CPACK_PACKAGE_VERSION_PATCH"); std::ostringstream ostr; - ostr << projVersionMajor << "." << projVersionMinor << "." - << projVersionPatch; + ostr << *projVersionMajor << "." << *projVersionMinor << "." + << *projVersionPatch; mf->AddDefinition("CPACK_PACKAGE_VERSION", ostr.str()); } int res = cpackGenerator->DoPackage(); if (!res) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Error when generating package: " << projName + "Error when generating package: " << *projName << std::endl); return 1; } |