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

Eric Noulard eric.noulard at gmail.com
Thu Apr 28 17:06:11 EDT 2011


2011/4/28 Alan Garny <alan.garny at dpag.ox.ac.uk>:
>> From: Eric Noulard [mailto:eric.noulard at gmail.com]
>> 2011/4/28 Alan Garny <alan.garny at dpag.ox.ac.uk>:
>> > Hi, I am using CMake/CPack (version 2.8.4) for my project and
>> > everything works fine except for a couple of files that I am trying to
>> > package on Windows. I would like those files to be read-only. I
>> > currently have something like:
>> >
>> > INSTALL(FILES ${CMAKE_SOURCE_DIR}/myFile DESTINATION myDestination
>> > PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
>> >
>> > and it works perfectly fine on Linux and Mac OS X, but not on Windows
>> > (using either ZIP or NSIS). Any idea why this would be the case? Just
>> > for testing purposes, I also tried
>>
>> Is it working with ZIP on Linux or MacOS as well?
>
> I don't use ZIP on Linux, but TGZ. Still, it works fine on Linux and the
> same with Mac OS X (I use ZIP on Mac OS X, as well as PackageMaker, and both
> are OK).

Same for me but I was trying to seek whether if it could be due to
ArchiveGenerator
or not. Obviously this is not the case.

>> > INSTALL(FILES ${CMAKE_SOURCE_DIR}/myFile DESTINATION myDestination)
>> >
>> > since the files are originally read-only, but to no avail.
>>
>> What happen (on Windows) if you execute the INSTALL target?
>> Do the installed files have the appropriate rights?
>
> No, they don't. They are writable while they shouldn't be.

So CPack is not the culprit.
Would try to open the cmake_install.cmake file corresponding
to the offending install(file ...)
You should find something like:

FILE(INSTALL <yourfile> DESTINATION <thedest>
        FILE_PERMISSIONS <perms>)

You could try to craft a tryPermission.cmake file which mimics the command
and execute only that part using

cmake -P tryPermission.cmake

and check whether if the permission is preserved or not.

>> Could you try to build a sample project which exhibit the problem open a
> bug
>> report and attach the sample project to it ?
>
> I will try to do that tomorrow.

Ok thanks, this will be helpful.
It may not be necessary if the previous steps shows that
that FILE(INSTALL ....FILE_PERMISSIONS ... ) is not working,
in this case send us the script.

PS: beware not to drop the ML address

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


More information about the CMake mailing list