Merge topic 'fix-wixobj-filenames'

2e16aff1 CPackWIX: Fix .wixobj output locations and filenames.
b0852ebc CPackWIX: Support patching of root <Feature> elements.
This commit is contained in:
Brad King 2015-03-09 09:45:57 -04:00 committed by CMake Topic Stage
commit 6f28bc6b51
2 changed files with 23 additions and 3 deletions

View File

@ -148,8 +148,10 @@
# Currently fragments can be injected into most # Currently fragments can be injected into most
# Component, File and Directory elements. # Component, File and Directory elements.
# #
# The special Id ``#PRODUCT`` can be used to inject content # The following additional special Ids can be used:
# into the ``<Product>`` element. #
# * ``#PRODUCT`` for the ``<Product>`` element.
# * ``#PRODUCTFEATURE`` for the root ``<Feature>`` element.
# #
# The following example illustrates how this works. # The following example illustrates how this works.
# #

View File

@ -265,13 +265,30 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
AppendUserSuppliedExtraSources(); AppendUserSuppliedExtraSources();
std::set<std::string> usedBaseNames;
std::stringstream objectFiles; std::stringstream objectFiles;
for(size_t i = 0; i < this->WixSources.size(); ++i) for(size_t i = 0; i < this->WixSources.size(); ++i)
{ {
std::string const& sourceFilename = this->WixSources[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 = std::string objectFilename =
cmSystemTools::GetFilenameWithoutExtension(sourceFilename) + ".wixobj"; this->CPackTopLevel + "/" + uniqueBaseName + ".wixobj";
if(!RunCandleCommand(sourceFilename, objectFilename)) if(!RunCandleCommand(sourceFilename, objectFilename))
{ {
@ -474,6 +491,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
featureDefinitions.AddAttribute("Title", cpackPackageName); featureDefinitions.AddAttribute("Title", cpackPackageName);
featureDefinitions.AddAttribute("Level", "1"); featureDefinitions.AddAttribute("Level", "1");
this->Patch->ApplyFragment("#PRODUCTFEATURE", featureDefinitions);
const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY"); const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY");
if(package) if(package)