I managed to get it working by using an intermediate script. One might want to generate the script instead of using the « RUN_IT » variable trick. This was only tested on Windows, but seems to work fine. Put the following code in a xxxxxx.cmake file, include it from your CMakeLists.txt and enjoy.
# This is a helper script to run BundleUtilities fixup_bundle as postbuild # for a target. The primary use case is to copy .DLLs to the build directory for # the Windows platform. It allows generator expressions to be used to determine # the binary location # # Usage : run_fixup(TARGET LIBS DIRS) # - TARGET : A cmake target # - See fixup_bundle for LIBS and DIRS arguments if(RUN_IT) # Script ran by the add_custom_command include(BundleUtilities) fixup_bundle("${TO_FIXUP_FILE}" "${TO_FIXUP_LIBS}" "${TO_FIXUP_DIRS}") # End of script ran by the add_custom_command else() set(THIS_FILE ${CMAKE_CURRENT_LIST_FILE}) message(${THIS_FILE}) function(run_fixup _target _libs _dirs) message(${THIS_FILE}) add_custom_command( TARGET ${_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -DRUN_IT:BOOL=ON -DTO_FIXUP_FILE=$<TARGET_FILE:${_target}> -DTO_FIXUP_LIBS=${_libs} -DTO_FIXUP_DIRS=${_dirs} -P ${THIS_FILE} COMMENT "Fixing up dependencies for ${_target}" VERBATIM ) endfunction() endif() De : Clément Gregoire Envoyé le :jeudi 4 mai 2017 08:37 À : Hendrik Sattler; Louis-Paul CORDIER; Cmake Mailing List Objet :Re: [CMake] DLL handling under CMake 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). Do you have a sample for this ? CMake would really benefit from having those features made more accessible instead of everyone having to write its own script Le sam. 29 avr. 2017 22:10, Hendrik Sattler <p...@hendrik-sattler.de> a écrit : Am 27. April 2017 10:43:50 MESZ schrieb Louis-Paul CORDIER <lp.cord...@dynamixyz.com>: >This steps are tedious and I'm wondering if there is a mechanism that >exists or that have to be imagined to make the DLL nightmare end. 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. I use the same for copying DLL files to the output directory to ease debugging. The advantage is the inspection of the exe for really needed DLL files. This AUTOMATICALLY handles the case debug vs. release. HS -- Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake