No subject


Wed May 9 12:08:04 EDT 2012


I would say that DEPENDS is used to actually link the command to a physical
file to know when the command needs to be triggered again.
As a consequence, my guess would be that CMake is probably looking for that
one in the source directory :-)

You could try to put an absolute path to the DEPENDS... or, I would
actually go for a post-build action of the executable target you have
defined:
add_custom_command(TARGET ${target}
  POST_BUILD
  COMMAND ${CMAKE_CURRENT_BINARY_DIR}/**bin/${target} ${resultFileFolder}
)
Ps: ARGS is now optional.

Hope this helps and kind regards,
-- 
  Amine

--047d7b2ee6578f6fc704cc40dbb2
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div class=3D"gmail_quote">On Mon, Oct 15, 2012 at 12:54 AM, Totte Karlsson=
 <span dir=3D"ltr">&lt;<a href=3D"mailto:totte at dunescientific.com" target=
=3D"_blank">totte at dunescientific.com</a>&gt;</span> wrote:<br><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;=
padding-left:1ex">
Hi,<br></blockquote><div><br></div><div>Hello !</div><div>=A0</div><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc s=
olid;padding-left:1ex">
I have an executable target, that I want to be executed as part of its own =
build.<br>
<br>
The target takes one argument, which is output folder of a text file. This =
text file is part of my source dir.<br>
<br>
In my CMake file I have, at the end<br>
<br>
set( resultFileFolder &quot;${PROJECT_SOURCE_DIR}/wiki/<u></u>reports&quot;=
)<br>
set( resultFile &quot;${resFileFolder}/tests_auto.<u></u>xml&quot;)<br>
<br>
add_custom_command(<br>
=A0 =A0 DEPENDS ${target}<br>
=A0 =A0 OUTPUT ${resultFile}<br>
=A0 =A0 COMMAND ${CMAKE_CURRENT_BINARY_DIR}/<u></u>bin/${target}<br>
=A0 =A0 ARGS ${resultFileFolder}<br>
=A0 =A0 )<br></blockquote><div><br></div><div>From the documentation (<a hr=
ef=3D"http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:add_custom_=
command">http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:add_cust=
om_command</a>) I would say that DEPENDS is used to actually link the comma=
nd to a physical file to know when the command needs to be triggered again.=
</div>
<div>As a consequence, my guess would be that CMake is probably looking for=
 that one in the source directory :-)</div><div><br></div><div>You could tr=
y to put an absolute path to the DEPENDS... or, I would actually go for a p=
ost-build action of the executable target you have defined:</div>
<div>add_custom_command(TARGET ${target}</div><div>=A0 POST_BUILD</div><div=
>=A0=A0COMMAND ${CMAKE_CURRENT_BINARY_DIR}/<u></u>bin/${target}=A0${resultF=
ileFolder}</div><div>)</div><div>Ps: ARGS is now optional.</div><div><br></=
div>
<div>Hope this helps and kind regards,</div></div>-- <br>=A0 Amine<br>

--047d7b2ee6578f6fc704cc40dbb2--


More information about the CMake mailing list