[CMake] CMake/CPack 2.8.4 - Windows - Can't package files as read-only?

Eric Noulard eric.noulard at gmail.com
Fri Apr 29 17:22:31 EDT 2011


2011/4/29 Alan Garny <alan.garny at dpag.ox.ac.uk>:
>> > This is not quite what I have. Instead, I have something like:
>> >
>> > FILE(INSTALL DESTINATION <myDestination> TYPE FILE PERMISSIONS
>> > OWNER_READ GROUP_READ WORLD_READ FILES <myFile>)
>>
>> fine, I was too lazy to check the syntax thoroughly
>>
>> Just create a tryPermission.cmake file with something similar you get in
> your
>> generated cmake_install.cmake
>>
>> and then from a command line run:
>>
>> cmake -P tryPermission.cmake
>>
>> and check the permission of the installed file.
>
> Ok, I have just given it a try and... it's working fine. From there, I
> thought I would check the contents of the _CPack_Packages folder which is
> created when running my CMakeLists.txt file. That folder contains a win32
> folder which itself contains both a ZIP and NSIS folder. Both of these
> folders eventually contain my read-only files with... the right permissions
> (i.e. read-only). However, these files, when unzipped/installed from the
> ZIP/NSIS files, don't have the right permissions (i.e. read-write rather
> than read-only), as previously mentioned. So, I get the feeling that the
> problem is with the ZIP/NSIS generation. In fact, I have had a quick look at
> the project.nsi file which got generated and I couldn't see anything that
> sets the permissions for my read-only files (something which should have
> been added, I believe -- at least, I had to do it for another project where
> I had to create a .nsi file 'by hand').

Ok thank you for this investigation.
This is worth a bug report, however if ZIP is working on Linux
I do not see why it shouldn't work on Windows because it's created
with the very same libarchive.

For NSIS the story is different and as you noted may be the generated NSIS
file must be fixed in order to put appropriate permission.

However as far as I know CPack generator do not handle file permissions
themselves, they do rely on what they find the _CPack_Packages/
specific subdirs. So if the permission are properly set in there
they should be preserved by the CPack generator.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list