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

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sat Oct 21 11:33:46 EDT 2006


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
__________________________


More information about the CMake mailing list