--- CPackRPM.cmake~ 2013-11-05 20:07:22.000000000 +0100 +++ CPackRPM.cmake 2014-01-20 13:26:36.578308592 +0100 @@ -207,6 +207,12 @@ # rpm -qp --scripts package.rpm ##end ##variable +# CPACK_RPM_FILES_DEFATTR +# Mandatory : NO +# Default : (-,root,root,-) +# May be used to provide specific %defattr() settings to the generated spec file +##end +##variable # CPACK_RPM_USER_FILELIST # CPACK_RPM__USER_FILELIST # Mandatory : NO @@ -892,6 +898,11 @@ set(CPACK_RPM_USER_BINARY_SPECFILE ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE}) endif() +# Set %defattr(-,root,root,-) unless there is a user provided string +if(NOT CPACK_RPM_FILES_DEFATTR) + set(CPACK_RPM_FILES_DEFATTR "(-,root,root,-)") +endif() + # We should generate a USER spec file template: # - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE # - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE @@ -959,7 +970,7 @@ \@CPACK_RPM_SPEC_PREUNINSTALL\@ %files -%defattr(-,root,root,-) +%defattr${CPACK_RPM_FILES_DEFATTR} \@CPACK_RPM_INSTALL_FILES\@ \@CPACK_RPM_ABSOLUTE_INSTALL_FILES\@ \@CPACK_RPM_USER_INSTALL_FILES\@