How to save permissions to files with the cmake directive "install directory"?

Prologue : I'm an idiot for this in the documentation

CMake-2.8.10.2

How do you create cmake to retain the original file permissions when installing the directory? For this project, I would like it to essentially copy some directories from my source tree to the installation tree. To wit:

install( DIRECTORY config runp DESTINATION ${CMAKE_INSTALL_PREFIX} PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE PATTERN "start_collection.snl" EXCLUDE ) 

Everything works as expected, except that executable scripts are copied with incorrect file permissions. In fact, none of the original file permissions is preserved. Setting permissions globally using FILE_PERMISSIONS and DIRECTORY_PERMISSIONS is what I don't want to do, and frankly, it will be a hack in this context.

In the world of shell scripts, I would do something simple:

 for i in config runp ; do tar cf - $i | tar -C $CMAKE_INSTALL_PREFIX -xf - done 
+7
source share
1 answer

The documentation suggests using USE_SOURCE_PERMISSIONS when calling install() :

 install( DIRECTORY config runp DESTINATION ${CMAKE_INSTALL_PREFIX} USE_SOURCE_PERMISSIONS PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE PATTERN "start_collection.snl" EXCLUDE ) 

Alternatively, you can use the install(PROGRAMS signature install(PROGRAMS this command. See the docs for more details .

+10
source

All Articles