Hello,<div><br></div><div>I think I&#39;ve already found the problem. In the custom command I run a CPack script, and CPack triggers a full build of the project, which in turn again triggers the custom command (and thus the CPack command).</div>
<div><br></div><div>Is it possible to make the CPack config so that only a specific target is being build? I have a one on one relation between library and zip file, and would like to be able to build one target and resulting zipfile.</div>
<div><br></div><div>Currently I am using a custom target, this also solves my problem, and would be fine if it didn&#39;t build always. Is it possible to add some up-to-date check to it?<br><br><div class="gmail_quote">2011/11/15 Alexander Broekhuis <span dir="ltr">&lt;<a href="mailto:a.broekhuis@gmail.com">a.broekhuis@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi all,<br><br>When using a custom command in a macro I see some strange behavior.<br><br><div>The following setup is used:<br>
I have a macro, called &quot;bundle&quot;, in this macro a custom command is added. This command uses a library as target, and executes cpack with a configuration. I use cpack to create a zip file inside my project with the library and additional resources.<br>

<br>This macro is used with the name of a library. When running the library target (make {lib-name}), the command is executed for all usages of the macro, instead of only for the given target. If I change it to a custom target, and add that target to the library target using add_dependencies it is all ok, but a custom target is always out-of-date, which is something I would like to prevent.</div>

<div><br></div><div>If I run the cpack command myself it is only executed once (as expected).</div><div><br></div><div>What am I doing wrong here?</div><div><br></div><div>TiA!</div><div><br></div><div>ps: The macro I use:<br>

------------------------<br>macro(bundle)<br>  PARSE_ARGUMENTS(BUNDLE &quot;FILES;DIRECTORIES&quot; &quot;&quot; ${ARGN})<br>  LIST(GET BUNDLE_DEFAULT_ARGS 0 BUNDLE_NAME)<br>  SET(__bundleConfig ${CMAKE_CURRENT_BINARY_DIR}/CPackConfig-${BUNDLE_NAME}-bundle.cmake)<br>

  CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/CPackConfig.in ${__bundleConfig} @ONLY)</div><div><br>  ADD_CUSTOM_COMMAND(TARGET ${BUNDLE_NAME} <br>    POST_BUILD<br>    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/bundles</div>

<div><br></div><div>    # This is an echo of the command. Running this myself on the command line works as expected<br>    COMMAND echo ${BUNDLE_NAME} ${CPACK_COMMAND} --config &quot;${__bundleConfig}&quot;</div><div><br>

</div><div>    # This is executed for each macro call I did<br>    COMMAND ${CPACK_COMMAND} --config &quot;${__bundleConfig}&quot;<br>  )<br>endmacro(bundle)</div><div>------------------------<span class="HOEnZb"><font color="#888888"><br>
--<br>Met vriendelijke groet,<br>
<br>Alexander Broekhuis<br></font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Met vriendelijke groet,<br><br>Alexander Broekhuis<br>
</div>