[CMake] Copying files to runtime directory

Tyler Roscoe tyler at cryptio.net
Mon Sep 21 14:20:40 EDT 2009


On Mon, Sep 21, 2009 at 05:48:38PM +0200, Jeroen Dierckx wrote:
> 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 :-)

If you don't want to train your users to build the INSTALL target rather
than doing "Build Solution" or whatever, you might be able to cheat by
running the install() stuff as a custom command. I think this worked for
me as a test:

add_custom_target (fake_install
        ALL
        ${CMAKE_COMMAND} -P cmake_install.cmake
)

The use of "ALL" there is debatable, I suppose. You could also use
add_dependencies to cause this install rule to run as part of any other
buildable.

> 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.

Today, we copy things manually like you seem to do.

In the future, I'd like to set up install() rules to handle this sort of
thing. I'd also like to make use of BundleUtilities and
GetPrerequisites, which are supposed to help with problems like getting
all the runtimes needed by my project.

> One of the problems I have with using install for this, is that I
> don't want to clutter the install directory with files generated at
> runtime. Also, I'm not sure Visual Studio would find all debug files
> (which are not installed, so inside the build directories). But I am
> going to try this method and see how it works out.

I don't understand this part. 

If the runtimes are needed to run the installed application, how can
they be considered "clutter"?

What "debug files" are you talking about?

tyler


More information about the CMake mailing list