Merge topic 'AddTopLevelForComponent'

5d18851 CPackArchive restore default behavior and provide new variable.
3cab24a CPack  Add top level directory in component install for Archive Generators
This commit is contained in:
David Cole 2012-02-07 15:34:39 -05:00 committed by CMake Topic Stage
commit a3e7913897
2 changed files with 14 additions and 2 deletions

View File

@ -57,13 +57,20 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive,
std::string dir = cmSystemTools::GetCurrentWorkingDirectory();
// Change to local toplevel
cmSystemTools::ChangeDirectory(localToplevel.c_str());
std::string filePrefix;
if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY"))
{
filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME");
filePrefix += "/";
}
std::vector<std::string>::const_iterator fileIt;
for (fileIt = component->Files.begin(); fileIt != component->Files.end();
++fileIt )
{
std::string rp = filePrefix + *fileIt;
cmCPackLogger(cmCPackLog::LOG_DEBUG,"Adding file: "
<< (*fileIt) << std::endl);
archive.Add(*fileIt);
<< rp << std::endl);
archive.Add(rp);
if (!archive)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: "

View File

@ -691,6 +691,11 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// one install directory for each component.
tempInstallDirectory +=
GetComponentInstallDirNameSuffix(installComponent);
if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY"))
{
tempInstallDirectory += "/";
tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME");
}
}
if (!setDestDir)