[CMake] Need suggestion on copying DLLs

Robert Dailey rcdailey.lists at gmail.com
Thu Nov 1 18:58:31 EDT 2012


I have a central repository of third party libraries, each containing
its own set of DLLs for debug and release. I have created a custom
target that will copy all third party DLLs for debug to the same
output directory that Visual Studio will place compiled DLLs and EXEs
(I also have a second custom target for third party release DLLs).

I want to setup my CMake scripts to setup each executable target to
depend on this custom target to copy DLLs over. The only problem is
that I don't know how to set it up per-configuration. When I build
debug versions of my executable targets in Visual Studio, it should
copy only the debug third party DLLs (currently it would have to know
to run the copy_dlls_debug target and not the copy_dlls_release
target).

I've thought of maybe using a post-build event, but then I'd have to
put the copy operation in multiple executable targets, which would be
more work than necessary (I only need to run the copy operation once
per solution).

Does anyone have any ideas on how I can set this up? I'm open to
setting this up from scratch again if I have to.

Thanks in advance.


More information about the CMake mailing list