[CMake] Copying files to runtime directory

Clinton Stimpson clinton at elemtech.com
Mon Sep 21 14:37:06 EDT 2009


On Monday 21 September 2009 09:48:38 am Jeroen Dierckx wrote:
> On Mon, Sep 21, 2009 at 5:29 PM, Tyler Roscoe <tyler at cryptio.net> wrote:
> > On Mon, Sep 21, 2009 at 02:54:04PM +0200, Jeroen Dierckx wrote:
> >> In Windows, we need to copy a bunch of files (dlls and other runtime
> >> dependencies) to the runtime directory, mostly belonging to external
> >> dependencies. Those files are different for debug and release builds.
> >> So I created a function to do just that. I came across several
> >> problems or limitations in cmake while doing that. Here is how I did
> >> it, and some remarks for each step
> >
> > I posted a thread last Thursday with similar questions.
> >
> > The short version, I think, is that you really want to use install() for
> > these kinds of operations. install() already knows how to EXCLUDE, copy
> > files on a per-configuration basis, and update files when they are
> > out-of-date.
> >
> > If you don't use install(), I think the types of hacks you mentioned
> > (copy all files, debug and release; manually handle exclusions) are the
> > only way to do what you want.
>
> I understand your reasoning, but I don't completely agree.
>
> We do use the install commands, but for preparing the build for
> packaging. That way, we can use cpack later on to release our SDK or
> applications. The problem is that I have to build the install target
> every time I want to debug something, which is not exactly ideal. But
> maybe doing that is easier than what I am trying to achieve now :-)
>
> How do other windows users do this kind of thing? The problem is that,
> when linking with external dynamic libraries, the dlls belonging to
> that library have to be in the runtime directory in order for the
> application to start.

I don't know about your setup, but for our apps, our developers just set the 
PATH environment variable for their dlls not built as part of the project.

Clint



More information about the CMake mailing list