BUG: Use the DESTDIR prefix when creating the directory in CPack when CPACK_SET_DESTDIR is ON. Thanks to Petri Hodju for reporting this regression to the CMake mailing list: http://www.cmake.org/pipermail/cmake/2008-October/024563.html.

This commit is contained in:
David Cole 2008-10-15 09:35:27 -04:00
parent cbbf0b8183
commit cc51ddd34b
1 changed files with 24 additions and 8 deletions

View File

@ -646,6 +646,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The
// value of the project's CMAKE_INSTALL_PREFIX is sent in here as
// the value of the CPACK_INSTALL_PREFIX variable.
//
std::string dir;
if (this->GetOption("CPACK_INSTALL_PREFIX"))
{
@ -653,14 +654,6 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
mf->AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str());
if ( !cmsys::SystemTools::MakeDirectory(dir.c_str()))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating temporary directory: "
<< dir << std::endl);
return 0;
}
cmCPackLogger(
cmCPackLog::LOG_DEBUG,
"- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf->AddDefinition)"
@ -668,6 +661,29 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'"
<< std::endl);
// Make sure that DESTDIR + CPACK_INSTALL_PREFIX directory
// exists:
//
if (cmSystemTools::StringStartsWith(dir.c_str(), "/"))
{
dir = tempInstallDirectory + dir;
}
else
{
dir = tempInstallDirectory + "/" + dir;
}
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"- Creating directory: '" << dir << "'" << std::endl);
if ( !cmsys::SystemTools::MakeDirectory(dir.c_str()))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem creating temporary directory: "
<< dir << std::endl);
return 0;
}
}
else
{