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

Craig Scott craig.scott at crascit.com
Tue Oct 23 06:06:41 EDT 2018


On Tue, Oct 23, 2018 at 4:43 PM Eric Noulard <eric.noulard at gmail.com> wrote:

> Le lun. 22 oct. 2018 à 23:05, Craig Scott <craig.scott at crascit.com> a
> écrit :
>
>>
>>> Yes I agree that having build rpath is useful.
>>> I am not aware of any mechanism that enable calling some tool during
>>> CPack's install step.
>>> Moreover I don't use MacOS at all so I don't have any experience with
>>> PackageMaker.
>>>
>>> May be some Mac user may shed some more light on this.
>>>
>>
>> You should be able to do this using install(SCRIPT) or install(CODE),
>> invoking the code signing through execute_process() as part of that
>> script/code.
>>
>
> I wasn't sure of that.
>
> So just to be clear  do we know for sure that install(SCRIPT)
> install(CODE) will run after the CMake builtin-generated install scripts?
> The builtin generated install script for target includes stripping, so for
> signing to work as expect we should be sure of the execution order?
> Or may be you suggest not to install(TARGET) for the concerned target and
> write install(SCRIPT) replacement for those?
>

My understanding is that install() commands are generally processed in the
order in which they appear in the directory scope. It is unspecified how
the order between directory scopes behaves, although this merge request
<https://gitlab.kitware.com/cmake/cmake/merge_requests/2434> (now merged to
master) makes things much more predictable.

I missed the earlier detail about when stripping occurred in relation to
installing. From what I can see, I think the stripping happens right after
the executable is copied/installed. Have a look at the generated
cmake_install.cmake file for one of your builds and search for
CMAKE_INSTALL_DO_STRIP to see how things get processed. If you add your own
install(CODE) or install(SCRIPT) calls after you've done the
install(TARGETS) calls, I would expect them to come after the stripping,
but I haven't tested this.


-- 
Craig Scott
Melbourne, Australia
https://crascit.com

New book released: Professional CMake: A Practical Guide
<https://crascit.com/professional-cmake/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181023/f10a7c58/attachment-0001.html>


More information about the CMake mailing list