I just tried it (maybe I did something wrong) but it does not work:<div><br></div><div><div>ADD_CUSTOM_COMMAND(TARGET ${MY_PROJECT } POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $&lt;TARGET_FILE:${MY_PROJECT }&gt; ${EXTERNAL_DIR} VERBATIM)</div>

<div>ADD_CUSTOM_COMMAND(TARGET ${MY_PROJECT } POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $&lt;TARGET_FILE:${MY_PROJECT }&gt;.lib ${EXTERNAL_DIR} VERBATIM)</div><div><br></div><div>The first line copy the dll, no pb with this it was already working. The second line try to copy project_d.dll.lib for Debug and project.dll.lib for Release  </div>

<div><br></div><div>How can I access the name of the output file without the extension?</div><br><div class="gmail_quote">2011/11/9 Rolf Eike Beer <span dir="ltr">&lt;<a href="mailto:eike@sf-mail.de">eike@sf-mail.de</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="HOEnZb"><div class="h5">&gt; Hi,<br>
&gt;<br>
&gt; I have different projects that generate a .lib and a .dll file, and I<br>
&gt; would<br>
&gt; like to copy these 2 files in a given directory as a post-build event. My<br>
&gt; main problem is that my debug libraries are post-fixed with _d, which<br>
&gt; require that I use the following code:<br>
&gt;<br>
&gt; SET(MY_PROJECT project)<br>
&gt; ADD_LIBRARY(${MY_PROJECT } SHARED ${HDRS} ${SOURCES} ... )<br>
&gt; [...]<br>
&gt; ADD_CUSTOM_COMMAND(TARGET ${MY_PROJECT } POST_BUILD COMMAND<br>
&gt; ${CMAKE_COMMAND} -E copy $&lt;TARGET_FILE:${MY_PROJECT }&gt; ${EXTERNAL_DIR}<br>
&gt; VERBATIM)<br>
&gt; ADD_CUSTOM_COMMAND(TARGET ${MY_PROJECT } POST_BUILD COMMAND<br>
&gt; ${CMAKE_COMMAND} -E copy ${LIBRARY_OUTPUT_PATH}/debug/${MY_PROJECT }_d.lib<br>
&gt; ${EXTERNAL_DIR}/${MY_PROJECT }_d.lib VERBATIM)<br>
&gt; ADD_CUSTOM_COMMAND(TARGET ${MY_PROJECT } POST_BUILD COMMAND<br>
&gt; ${CMAKE_COMMAND} -E copy ${LIBRARY_OUTPUT_PATH}/release/${MY_PROJECT }.lib<br>
&gt; ${EXTERNAL_DIR}/${MY_PROJECT }.lib VERBATIM)<br>
&gt;<br>
&gt; The main problem is that the tool crash when I compile it the first time.<br>
&gt; For instance if I start to compile in Release the _d.lib file does not<br>
&gt; exist and it does not even process to copying the release .lib. Ok, it<br>
&gt; works if I compile it in the right order, but I would prefer to have a<br>
&gt; clean code for this.<br>
&gt;<br>
&gt; I have been looking at using<br>
&gt; INSTALL(TARGETS ${MY_PROJECT} DESTINATION ${EXTERNAL_DIR} COMPONENT<br>
&gt; Libraries)<br>
&gt; but it creates a separate install vcproj that runs after all my projects,<br>
&gt; and I need my libraries copied right after the compilation as other<br>
&gt; projects depend on these output. So this is not a solution for me.<br>
&gt;<br>
&gt; So I tryied to have a look at per configuration ADD_CUSTOM_COMMAND. I<br>
&gt;  found different discussion about this problem, but I don&#39;t manage to make<br>
&gt; it work:<br>
&gt; <a href="http://public.kitware.com/Bug/view.php?id=9974" target="_blank">http://public.kitware.com/Bug/view.php?id=9974</a><br>
&gt; <a href="http://public.kitware.com/Bug/view.php?id=11209" target="_blank">http://public.kitware.com/Bug/view.php?id=11209</a><br>
&gt;<br>
&gt; The first one provide a patch, but I don&#39;t manage to get it working with<br>
&gt; cmake. Is there a special way to include these &quot;patches&quot; to our<br>
&gt; configurations?<br>
<br>
</div></div>Use generator expressions to get the name of the generated files.<br>
<span class="HOEnZb"><font color="#888888"><br>
Eike<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>_______________________________________<br><br>Ludovic Hoyet<br>Research Fellow, <div><span style="font-family:Tahoma, Helvetica, sans-serif;font-size:13px;line-height:16px;background-color:rgb(255, 255, 255)">Graphics Vision and Visualisation group,</span><br>

Trinity College Dublin<br><a href="http://www.scss.tcd.ie/~hoyetl/" target="_blank">http://www.scss.tcd.ie/~hoyetl/</a></div><br>
</div>