[CMake] copy dependant shared libs locally

Alexander Neundorf a.neundorf-work at gmx.net
Sun May 20 07:51:03 EDT 2012


On Thursday 17 May 2012, Daniel Krikun wrote:
> Hello,
> 
> I would like to trace shared library dependencies between targets (and also
> to external packages) and then copy required dll's to output bin directory
> (so that they are immediately available, without PATH editing) in the
> post-build.
> However, for debug configuration, I need to copy debug dll's (usually with
> 'd' suffix) and for release configuration - release dll's.
> 
> I can copy files to run-time directory using add_custom_command, but how
> could I make a distinction for the release-debug files?

So you want to be able to run your executables directly from the buildtree, 
right ?

To solve the problem for dlls which are built in your project, you can adjust 
the directories where cmake creates executables and shared libs, so that they 
are created in the same directory and the dlls will be found:

set(RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" )

This should put both exes and dlls into one common directory.

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120520/967302b6/attachment.htm>


More information about the CMake mailing list