[CMake] Installing compiled targets

Robert Dailey rcdailey.lists at gmail.com
Wed Feb 27 12:24:49 EST 2013


Hello,

Right now I have multiple executables and libraries that are built
with Visual Studio (as generated by CMake). Suppose I have 4 shared
library targets:

A, B, C, D

And I have two executable targets:

EXE1, EXE2

The dependencies for EXE1 are:

A, B, C

Dependencies for EXE2 are:

C, D

In my global output directory, *all* binaries for all targets are stored there:

A, B, C, D, EXE1, EXE2

Sometimes I like to copy all the files for a target (all dependencies)
and ZIP those up so I can send them to someone. Or maybe I need to be
able to separate them out for an installer script that packages them
for a release.

Is there a way I can utilize CMake to "install" a target's output
binary + dependencies? For example, when I "install" EXE2, it and its
dependencies should be copied to some predetermined directory, so it
would contain only:

C.dll
D.dll
EXE2.exe

Any way to make this happen? Thanks.


More information about the CMake mailing list