[CMake] CPack WIX examples

jmerkow jmerkow at gmail.com
Wed Sep 24 15:26:05 EDT 2014


Ok I'm going the fragment injection route, but having some issues.

So I found the component id for the target that these registry values will
be needed by in files.wxs:
<Component Id="CMP_ID_1" Guid="*">
  <File Id="FILE_ID_1" Source="C:/blah/blah/Bin/myapp.exe" KeyPath="yes"/>
</Component>
In this case its 'CMP_ID_1', using the first cmp id seemed like a safe bet
in general to have it referenced by a feature.

So a configurable patch.xml.in looks something like:
<CPackWiXPatch>
    <CPackWiXFragment Id="CMP_ID_1">
        <Registry Id='regid1' Root='HKLM'
Key='Software\myproj\@myproj_VERSION@
@myproj_MAJOR_VERSION at .@myproj_MINOR_VERSION@' Name='InstallDir'
Action='write' Type='string' Value='[INSTALL_ROOT]' />
<Registry Id='regid2' ... />
...
    </CPackWiXFragment>
</CPackWiXPatch>

There are just a few in there to test the process.

In CMake, i configure and add it the file to CPACK_WIX_PATCH_FILE:
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/windows/registry-patch.xml.in
"${TEMP_DIR}/registry-patch.xml" @ONLY)
set(CPACK_WIX_PATCH_FILE "${TEMP_DIR}/registry-patch.xml")

Then I generate the msi using cpack.  However the resulting msi doesn't set
any registry entries, I also don't see any of the entries anywhere in the
resulting xml.  
I did notice that in the documentations [1] and in your example your
component id is more complex..
It looks to be something like (and I'm abusing cmake generator expressions
for brevity)
Id='CM_CP_ at cmake_component@. at TARGET_FILE_DIR:tgt at .@TARGET_FILE_DIR:tgt@'.  I
tried an Id of this nature as well (i.e. <CPackWiXFragment
Id="CMP_CP_CoreExecutables.Bin.myapp.exe">) but this also did not work.
Am I obtaining the id wrong? The documentation is a little confusing
compared to whats being generated. so I'm not sure exactly sure if I have
the proper id. Is there a way to get the Id from the in cmake to configure
the file directly?  Maybe there is another issue entirely?

-Jameson
[1]
http://www.cmake.org/cmake/help/v3.0/module/CPackWIX.html?highlight=cpack_wix_patch
[2]
https://github.com/ngladitz/cmake-wix-testsuite/tree/master/fragment_injection



--
View this message in context: http://cmake.3232098.n2.nabble.com/CPack-WIX-examples-tp7588561p7588591.html
Sent from the CMake mailing list archive at Nabble.com.


More information about the CMake mailing list