[CMake] [binary dir] breaks INSTALL(...) if added to ADD_SUBDIRECTORY(...)

Peter Visser pervulgo at gmail.com
Sat Oct 21 12:27:07 EDT 2006


The default build directory works fine, however I would like to group some
components:

ADD_SUBDIRECTORY (Example1 foo)
ADD_SUBDIRECTORY (Example2 foo)
ADD_SUBDIRECTORY (Example3 bar)
ADD_SUBDIRECTORY (Example4 bar)

In my case I can omit the foo and bar since I don't have conflicting names
in the executables/libraries in example 1 to 4. But it is "nice" to have the
components separated already in the build dir for testing without doing a
"make install" first.

Since the ADD_SUBDIRECTORY(...) has nothing to do with the INSTALL(...)
could this be a bug?

Thanks,

Peter.

On 10/21/06, Alan W. Irwin <irwin at beluga.phys.uvic.ca> wrote:
>
> On 2006-10-21 12:39+0200 Peter Visser wrote:
>
> > Hello,
> >
> > The following example works fine:
> >
> > ----
> > In the top CMakeLists.txt
> > ADD_SUBDIRECTORY (Example1)
> > ADD_SUBDIRECTORY (Example2)
> > ----
> > In the subdirectories Example1/Example2
> > INSTALL(TARGETS Example1/Example2
> >       RUNTIME DESTINATION bin
> >           LIBRARY DESTINATION lib
> >           ARCHIVE DESTINATION lib
> > )
> > -----
> > In the INSTALL both the executables Example1 and Example2 are added to
> the
> > bin directory
> >
> > However adding a [binary dir] to the ADD_SUBDIRECTORY(...) breaks the
> > INSTALL
> > ----
> > In the top CMakeLists.txt
> > ADD_SUBDIRECTORY (Example1 foo)
> > ADD_SUBDIRECTORY (Example2 foo)
> > ----
> > In this case only Example2 is added to the bin directory. (Only the last
> > occurence of the ADD_SUBDIRECTORY(...) is added)
> > Is this behaviour intentionally or do I misunderstand the [binary dir]
> > argument.
>
> The documentation of ADD_SUBDIRECTORY definitely needs work, but my
> interpretation of "binary_dir" is it is the path of the build directory
> and
> not the install directory (so it has nothing to do with your INSTALL
> command
> directories). Thus your commands above are trying to map two separate
> subdirectories to the same "foo" build subdirectory, and that is probably
> causing the issue. Try keeping the two build subdirectories separate, i.e
> .,
> foo1 and foo2 (or take the default build subdirectory names as in your
> first
> working example).
>
> Alan
> __________________________
> Alan W. Irwin
>
> Astronomical research affiliation with Department of Physics and
> Astronomy,
> University of Victoria (astrowww.phys.uvic.ca).
>
> Programming affiliations with the FreeEOS equation-of-state implementation
> for stellar interiors (freeeos.sf.net); PLplot scientific plotting
> software
> package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
> Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
> (lbproject.sf.net).
> __________________________
>
> Linux-powered Science
> __________________________
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20061021/4306eda9/attachment.htm


More information about the CMake mailing list