[CMake] Signing individual binary and problem with PackageMaker CPack generator

Anatoly Belyaev cross at cryptopro.ru
Mon Oct 22 05:56:55 EDT 2018


We use "PackageMaker" generator on MacOS.  But i don't think it is CPack 
specific tool does call strip command.  The code for RPATH rewrite and 
strip cmd is located in cmake_install.cmake. As i understand CPack calls 
make install to tmp dir and then creates package.

Having different RPATH for build tree is useful. May be there is a way 
to call sign tool in the install stage? But reading the doc to CMake 
install command, doesn't help me find solution for this.

----------------------------------------
Best regards, Anatoly Belyaev


On 22.10.2018 11:55, Eric Noulard wrote:
>
>
> Le lun. 22 oct. 2018 à 10:21, Anatoly Belyaev <cross at cryptopro.ru 
> <mailto:cross at cryptopro.ru>> a écrit :
>
>     We use CMake
>
>     |add_custom_command(TARGET POST_BUILD COMMAND codesign ...) |
>
>     for signing executable files on build. It works fine, but when
>     CPack generates package it rewrites rpath on executable files and
>     call strip command on them. This changes the file and invalidates
>     the signature. Is there any way in CMake to sign binary files
>     after CPack finishes install and before actual packaging?
>
> As you discovered CPack runs at a different moment than CMake (see: 
> https://github.com/dev-cafe/cmake-cookbook/blob/master/figures/cmake-times/cmake-times.jpg)
>
> RPATH is rewritten because you may have different build and install RPATH.
> https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling.
>
> Concerning the strip part I'm not sure CPack does that. May be the 
> CPack generator specific tool does it?
> I bet there is no generic way to that without extending CPack or the 
> particular generator ou are using.
> What CPack generator(s) do you use?
>
> -- 
> Eric

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181022/22adda4f/attachment.html>


More information about the CMake mailing list