CPackWIX: Fix .wixobj output locations and filenames.

Preserve all but the last extension when generating .wixobj output
filenames from source files and make sure they are unique.

Output .wixobj files in cpack staging area instead
of the current working directory.
This commit is contained in:
Nils Gladitz 2015-03-06 14:19:30 +01:00
parent b0852ebc09
commit 2e16aff1e2
1 changed files with 18 additions and 1 deletions

View File

@ -265,13 +265,30 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
AppendUserSuppliedExtraSources();
std::set<std::string> usedBaseNames;
std::stringstream objectFiles;
for(size_t i = 0; i < this->WixSources.size(); ++i)
{
std::string const& sourceFilename = this->WixSources[i];
std::string baseName =
cmSystemTools::GetFilenameWithoutLastExtension(sourceFilename);
unsigned int counter = 0;
std::string uniqueBaseName = baseName;
while(usedBaseNames.find(uniqueBaseName) != usedBaseNames.end())
{
std::stringstream tmp;
tmp << baseName << ++counter;
uniqueBaseName = tmp.str();
}
usedBaseNames.insert(uniqueBaseName);
std::string objectFilename =
cmSystemTools::GetFilenameWithoutExtension(sourceFilename) + ".wixobj";
this->CPackTopLevel + "/" + uniqueBaseName + ".wixobj";
if(!RunCandleCommand(sourceFilename, objectFilename))
{