Reputation: 2025
I had a question involving setting permissions using CMake. Right now I am currently modifying CMake files that build our Java code using an Ant script. We want to convert our Java code to CMake so we can make use of Build Avoidance. After reading the CMake documentation, it seems like we can compile and install our Java packages, but the install_jar() command does not allow us to set permissions like the install command does.
I'm assuming we want to use the install_jar command so we can make use of the find_jar command when compiling against dependencies, so I would like to keep the install_jar command. Is there some sort of chmod command for CMake, or some best practices way for setting the installed files permissions after they have been installed?
Thanks,
Upvotes: 1
Views: 660
Reputation: 34411
The install_jar()
definition is, basically, just install()
call:
function(INSTALL_JAR _TARGET_NAME _DESTINATION)
get_property(__FILES
TARGET ${_TARGET_NAME}
PROPERTY INSTALL_FILES
)
if (__FILES)
install(FILES ${__FILES}
DESTINATION ${_DESTINATION}
)
else (__FILES)
message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.")
endif (__FILES)
endfunction(INSTALL_JAR _TARGET_NAME _DESTINATION)
So you can just write your own install_jar_with_args()
and add PERMISSIONS
keyword to the install()
call.
Probably, this problem needs to be reported to CMake devs.
Upvotes: 1