<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=FR link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal>I managed to get it working by using an intermediate script.</p><p class=MsoNormal>One might want to generate the script instead of using the « RUN_IT » variable trick.</p><p class=MsoNormal>This was only tested on Windows, but seems to work fine.</p><p class=MsoNormal>Put the following code in a xxxxxx.cmake file, include it from your CMakeLists.txt and enjoy.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal># This is a helper script to run BundleUtilities fixup_bundle as postbuild</p><p class=MsoNormal># for a target. The primary use case is to copy .DLLs to the build directory for</p><p class=MsoNormal># the Windows platform. It allows generator expressions to be used to determine</p><p class=MsoNormal># the binary location</p><p class=MsoNormal>#</p><p class=MsoNormal># Usage : run_fixup(TARGET LIBS DIRS)</p><p class=MsoNormal># - TARGET : A cmake target</p><p class=MsoNormal># - See fixup_bundle for LIBS and DIRS arguments</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>if(RUN_IT)</p><p class=MsoNormal># Script ran by the add_custom_command</p><p class=MsoNormal>                include(BundleUtilities)</p><p class=MsoNormal>                fixup_bundle("${TO_FIXUP_FILE}" "${TO_FIXUP_LIBS}" "${TO_FIXUP_DIRS}")</p><p class=MsoNormal># End of script ran by the add_custom_command</p><p class=MsoNormal>else()</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>set(THIS_FILE ${CMAKE_CURRENT_LIST_FILE})</p><p class=MsoNormal>message(${THIS_FILE})</p><p class=MsoNormal>function(run_fixup _target _libs _dirs)</p><p class=MsoNormal>                message(${THIS_FILE})</p><p class=MsoNormal>                add_custom_command(</p><p class=MsoNormal>                               TARGET ${_target} POST_BUILD</p><p class=MsoNormal>                               COMMAND ${CMAKE_COMMAND} -DRUN_IT:BOOL=ON -DTO_FIXUP_FILE=$<TARGET_FILE:${_target}> -DTO_FIXUP_LIBS=${_libs} -DTO_FIXUP_DIRS=${_dirs}  -P ${THIS_FILE}</p><p class=MsoNormal>                               COMMENT "Fixing up dependencies for ${_target}"</p><p class=MsoNormal>                               VERBATIM</p><p class=MsoNormal>                )</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>endfunction()</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>endif()</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='border:none;padding:0cm'><b>De : </b><a href="mailto:lectem@gmail.com">Clément Gregoire</a><br><b>Envoyé le :</b>jeudi 4 mai 2017 08:37<br><b>À : </b><a href="mailto:post@hendrik-sattler.de">Hendrik Sattler</a>; <a href="mailto:lp.cordier@dynamixyz.com">Louis-Paul CORDIER</a>; <a href="mailto:cmake@cmake.org">Cmake Mailing List</a><br><b>Objet :</b>Re: [CMake] DLL handling under CMake</p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I'd also be interested in this. I saw an old mail in the ML about this, but it seems fixup_bundle is old and cant use generator expressions, making it hard to use (I don't want to hardcode the executable path).<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Do you have a sample for this ?</p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>CMake would really benefit from having those features made more accessible instead of everyone having to write its own script </p><div><div><p class=MsoNormal>Le sam. 29 avr. 2017 22:10, Hendrik Sattler <<a href="mailto:post@hendrik-sattler.de">post@hendrik-sattler.de</a>> a écrit :</p></div></div></div><p class=MsoNormal style='margin-left:4.8pt'><br><br>Am 27. April 2017 10:43:50 MESZ schrieb Louis-Paul CORDIER <<a href="mailto:lp.cordier@dynamixyz.com" target="_blank">lp.cordier@dynamixyz.com</a>>:<br>>This steps are tedious and I'm wondering if there is a mechanism that<br>>exists or that have to be imagined to make the DLL nightmare end.<br><br>I use BundleUtilities to achieve the copying of DLL files to the installation directory. The main problem for this is to enumerate the needed directories.<br><br>I use the same for copying DLL files to the output directory to ease debugging.<br><br>The advantage is the inspection of the exe for really needed DLL files. This AUTOMATICALLY handles the case debug vs. release.<br><br>HS<br><br>--<br>Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.<br>--<br><br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</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>Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br><br>CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</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>Follow this link to subscribe/unsubscribe:<br><a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>