[CMake] Shared Libraries & dependencies

Andreas Pakulat apaku at gmx.de
Fri Dec 12 02:49:23 EST 2008


On 11.12.08 15:13:11, Robert Dailey wrote:
> On Thu, Dec 11, 2008 at 3:05 PM, Andreas Pakulat <apaku at gmx.de> wrote:
> 
> > On 11.12.08 14:50:45, Robert Dailey wrote:
> > > To elaborate, I'm specifically getting this error message:
> > >
> > > CMake Error at vfx/CMakeLists.txt:74 (install):
> > >   install TARGETS given target "messenger" which does not exist in this
> > >   directory.
> > >
> > > And this is what my INSTALL() command looks like:
> > >
> > > install( TARGETS messenger ARCHIVE DESTINATION "${target_bin_dir}" )
> > >
> > >
> > > I have no idea what the error message above means. At first I thought it
> > was
> > > due to the ordering in which I defined my projects, but I'm not sure
> > that's
> > > true. The 'messenger' project is defined in another sibling directory,
> > > perhaps that is the issue?
> >
> > Well, the error says exactly that, so there's not really a reason to not
> > believe thats the case, is there ;) I wasn't aware of that, but apparently
> > you can only install targets in the same CMakeLists.txt as they're defined.
> > This kinda makes sense too, because it makes sure that all stuff thats done
> > to a target is localized in one CMakeLists.txt.
> 
> But nothing is "being done to" the messenger target. It's simply taking
> something from the already configured target and placing it into another
> target's binary output dir. I don't see the issue here. This feels like an
> arbitrary limitation.

Huh? You're adding a rule to install target messenger when running make
install. That is something you do to that target. Its very good that cmake
forces you to have this along with the targets definition, because from the
install rule you can't see:

- what type of target it is
- what sources are involved
- what compiler flags are set
- what libraries it links against

Let me say that again: install is for installing the targets into a
user-defined location, outside of the builddirectory, usually taking
CMAKE_INSTALL_PREFIX into account. A way to tell cmake where to place built 
files inside the builddir are the
(ARCHIVE|LIBRARY|RUNTIME)_OUTPUT_DIRECTORY variables. So if you set
RUNTIME_OUTPUT_DIRECTORY globally to CMAKE_BINARY_DIR/bin all your .exe and
.dll should end up there.

Andreas

-- 
You're ugly and your mother dresses you funny.


More information about the CMake mailing list