MantisBT - CMake
View Issue Details
0014467CMakeCPackpublic2013-10-09 05:462015-07-08 08:57
Ådne Hovda 
Nils Gladitz 
normalfeaturealways
closedwon't fix 
CMake 2.8.11.2 
 
0014467: WiX Generator: Move the TARGETDIR directory from directories.wxs to the main template
Move the main <Directory Id="TARGETDIR" Name="SourceDir" /> tag
including the program files folder entry to the main.wxs file, leaving
only INSTALL_ROOT and below in directories.wxs. That makes it possible to override the install location using a custom template (e.g. C:\program files\company\product). Selecting the
correct ProgramFilesFolder/ProgramFiles64Folder should be handled by a
new include variable and a new <?if ?> block.

Here are some excerpts to (hopefully) clarify my ideas:


cpack_variables.wxi:

<?define CPACK_WIX_ARCH="x86" ?>


WIX.template.in:

<?if $(var.CPACK_WIX_ARCH) = x86 ?>
  <?define Win64 = "no" ?>
  <?define SystemFolder = "SystemFolder" ?>
  <?define CAQuietExec = "CAQuietExec" ?>
  <?define ProgramFilesFolder = "ProgramFilesFolder" ?>
  <?define ExecSecureObjects = "ExecSecureObjects" ?>
<?else?>
  <?define Win64 = "yes" ?>
  <?define SystemFolder = "System64Folder" ?>
  <?define CAQuietExec = "CAQuietExec64" ?>
  <?define ProgramFilesFolder = "ProgramFiles64Folder" ?>
  <?define ExecSecureObjects = "ExecSecureObjects_64" ?>
<?endif?>


<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="$(var.ProgramFilesFolder)">
    <DirectoryRef Id="INSTALL_ROOT" />
  </Directory>
</Directory>


directories.wxs:

<Directory Id="INSTALL_ROOT" Name="MyProduct">
  <Directory Id="bin" Name="bin"/>
  <Directory Id="include" Name="include"/>
  <Directory Id="lib" Name="lib"/>
  <Directory Id="share" Name="share">
    <Directory Id="share.man" Name="man">
      <Directory Id="share.man.man3" Name="man3"/>
    </Directory>
  </Directory>
</Directory>
No tags attached.
Issue History
2013-10-09 05:46Ådne HovdaNew Issue
2013-10-12 17:12Nils GladitzStatusnew => assigned
2013-10-12 17:12Nils GladitzAssigned To => Nils Gladitz
2013-12-18 13:04Nils GladitzNote Added: 0034794
2013-12-18 13:04Nils GladitzStatusassigned => feedback
2014-03-20 04:36Richard UlrichNote Added: 0035444
2014-03-20 05:11Nils GladitzNote Added: 0035445
2015-02-13 06:19Nils GladitzNote Added: 0037967
2015-02-13 06:19Nils GladitzStatusfeedback => resolved
2015-02-13 06:19Nils GladitzResolutionopen => won't fix
2015-07-08 08:57Robert MaynardNote Added: 0039051
2015-07-08 08:57Robert MaynardStatusresolved => closed

Notes
(0034794)
Nils Gladitz   
2013-12-18 13:04   
set(CPACK_PACKAGE_INSTALL_DIRECTORY "company/product") would probably cover your example use case.

Would this suffice or do you have additional requirements?
(0035444)
Richard Ulrich   
2014-03-20 04:36   
Just stumbled over this entry...
I had the same use case, and I solved it almost as you propose.
As this is for Windows, I had to use four backslashes instead of the single forward slash in your example.
(0035445)
Nils Gladitz   
2014-03-20 05:11   
0014467:0035444 : are you sure you had to use backslashes?
The single forward slash worked for me as-is.
(0037967)
Nils Gladitz   
2015-02-13 06:19   
There hasn't been any feedback on the issue since it was created so I am resolving it for now. Feel free to reopen or create a new issue if you have additional requirements that aren't already covered.
(0039051)
Robert Maynard   
2015-07-08 08:57   
Closing resolved issues that have not been updated in more than 4 months.