[CMake] Setting permissions with CPack/WiX installer

Nils Gladitz nilsgladitz at gmail.com
Fri Apr 5 05:27:52 EDT 2019


On Fri, Apr 5, 2019 at 5:25 AM Cook, Steven (G&I) <Steven.Cook at riotinto.com>
wrote:

> Hi all,
>
>
>
> I would like to set the permissions on some files and directories in my
> WiX installer. It looks like the CPACK_WIX_ACL property should be suitable,
> but I can’t get it to work. There are examples of its usage in this project:
>
> https://github.com/ngladitz/cmake-wix-testsuite/tree/master/properties
>
>
>
> Typically something like this:
>
>   set_property(INSTALL
>
>     empty_directory_with_property
>
>     non_empty_directory_with_property
>
>     PROPERTY CPACK_WIX_ACL “Everyone=GenericRead,GenericWrite,CreateFile”
>
>   )
>
>
>
> but this example doesn’t work for me with cmake 3.14.0. None of the .wxs
> files that are produced contain the expected Permission property. After
> adding some debugging to cmake, I found that
> cmCPackWIXGenerator::AddDirectoryAndFileDefinitions calls GetInstalledFile,
> which always returns NULL. This prevents the ACL from being applied.
>

Been a while since I looked at this but it still seems to work for me in
3.14.0.
Corresponding <Permission> elements are generated in files.wxs:

        <DirectoryRef Id="CM_DP_empty_directory_with_property">
            <Component Id="CM_C_EMPTY_CM_DP_empty_directory_with_property"
Guid="3D2461E6-022E-462E-BE97-3DE14D7DFEBE">
                <CreateFolder>
                    <Permission User="Everyone" GenericRead="yes"
GenericWrite="yes" CreateFile="yes"/>
                </CreateFolder>
            </Component>
        </DirectoryRef>

        <DirectoryRef Id="CM_DP_non_empty_directory_with_property">
            <Component
Id="CM_C_EMPTY_CM_DP_non_empty_directory_with_property"
Guid="20B69238-5353-4C30-A001-3A106A0B1737">
                <CreateFolder>
                    <Permission User="Everyone" GenericRead="yes"
GenericWrite="yes" CreateFile="yes"/>
                </CreateFolder>
            </Component>
        </DirectoryRef>

Nils
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190405/65907fca/attachment.html>


More information about the CMake mailing list