<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>I tried example like this</p>
<p>set(test_SRC main.cpp)<br>
install(CODE "MESSAGE(\"CODE1\")")<br>
add_executable(test ${test_SRC})<br>
install(TARGETS test DESTINATION ${CMAKE_INSTALL_BINDIR})<br>
install(CODE "MESSAGE(\"CODE2\")")<br>
<br>
Then i checked cmake_install.cmake and "CODE1" cmd will be
executed before strip command and "CODE2" will be executed after
strip command. So I think that this is the good place to invoke
signing tool for release builds. Probably you should have two
places with signing if you want to have signed binary in build
tree and install tree. One in add_custom_command and one in
install(CODE ... ). But it's not a big problem. <br>
</p>
<div class="moz-signature">----------------------------------------
<br>
Best regards, Anatoly Belyaev<br>
<br>
</div>
<div class="moz-cite-prefix">On 23.10.2018 13:33, Eric Noulard
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAPASGLoeW-vASPwejy+mbHc+AfpHNHDqMzSX8OvjwgRXFkMySA@mail.gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr"><br>
<br>
<div class="gmail_quote">
<div dir="ltr">Le mar. 23 oct. 2018 à 12:06, Craig Scott <<a
href="mailto:craig.scott@crascit.com"
moz-do-not-send="true">craig.scott@crascit.com</a>> a
écrit :<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><br>
<br>
<div class="gmail_quote">
<div dir="ltr">On Tue, Oct 23, 2018 at 4:43 PM Eric
Noulard <<a href="mailto:eric.noulard@gmail.com"
target="_blank" moz-do-not-send="true">eric.noulard@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr">Le lun. 22 oct. 2018 à 23:05, Craig
Scott <<a
href="mailto:craig.scott@crascit.com"
target="_blank" moz-do-not-send="true">craig.scott@crascit.com</a>>
a écrit :<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0
0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div dir="ltr">
<div class="gmail_quote">
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex">
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
<div>Yes I agree that having build
rpath is useful.</div>
<div>I am not aware of any mechanism
that enable calling some tool during
CPack's install step.</div>
<div>Moreover I don't use MacOS at all
so I don't have any experience with
PackageMaker.</div>
<div><br>
</div>
<div>May be some Mac user may shed
some more light on this.</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>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.</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>I wasn't sure of that. </div>
<div><br>
</div>
<div>So just to be clear do we know for sure that
install(SCRIPT) install(CODE) will run after the
CMake builtin-generated install scripts?</div>
<div>The builtin generated install script for
target includes stripping, so for signing to
work as expect we should be sure of the
execution order?</div>
<div>Or may be you suggest not to install(TARGET)
for the concerned target and write
install(SCRIPT) replacement for those?</div>
</div>
</div>
</blockquote>
</div>
<div><br>
</div>
<div>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 <a
href="https://gitlab.kitware.com/cmake/cmake/merge_requests/2434"
target="_blank" moz-do-not-send="true">this merge
request</a> (now merged to master) makes things much
more predictable.</div>
<div><br>
</div>
<div>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.</div>
</div>
</blockquote>
<div><br>
</div>
<div>I'll have a look, not that I need it but I'd like to
know.</div>
<div>Thank you Craig.</div>
<div><br>
</div>
</div>
-- <br>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>Eric<br>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>