CPack: use a distinct checksum file for each generator

Different CPack generators could produce checksum files with the same
name which were overwritten by each other since only package name
without extensions was used for checksum file name generation.  This
patch adds package extension to checksum files to prevent collisions.

Fixes: #16840
This commit is contained in:
Domen Vrankar
2017-09-20 00:00:42 +02:00
committed by Brad King
parent 4547d9a830
commit b06870e5ff
2 changed files with 3 additions and 5 deletions

View File

@@ -999,8 +999,7 @@ int cmCPackGenerator::DoPackage()
/* Generate checksum file */
if (crypto.get() != nullptr) {
std::string hashFile(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"));
hashFile +=
"/" + filename.substr(0, filename.rfind(this->GetOutputExtension()));
hashFile += "/" + filename;
hashFile += "." + cmSystemTools::LowerCase(algo);
cmsys::ofstream outF(hashFile.c_str());
if (!outF) {