On 2009-12-08 13:59+1200 Hugh Sorby wrote:


I am trying to use INSTALL( EXPORT ... but failing. I have a project like this

ImageMagick/CMakeLists.txt -- 1.
ImageMagick/magick/CMakeLists.txt -- 2.
ImageMagick/coders/CMakeLists.txt -- 3.

1. calls ADD_SUBDIRECTORY for both 2 and 3
2. has a target "magick" that is a library
3. has a target "coders" that is a library

2 needs 3 so in 2 I have the line

TARGET_LINK_LIBRARIES( magick coders )

then I have

INSTALL( TARGETS magick EXPORT magick-targets ARCHIVE
   DESTINATION lib )

and then I try

INSTALL( EXPORT magick-targets DESTINATION lib/cmake )

which doesn't fly and I get the error message

CMake Error: INSTALL(EXPORT "MagickCore-targets" ...) includes target "MagickCore" which requires target "coders" that is not in the export set.

Is there someone who can enlighten me on how this works I have read the documentation but I am unclear (as in it's not crystal to me).

The magick library is not going to work without the coders library
dependency. So in this case you need to modify your INSTALL(TARGETS coders
... command to include "EXPORT magick-targets" (just like you have already
done for the magick target) to put coders in your export set.

After that, INSTALL( EXPORT magick-targets DESTINATION lib/cmake ) should
work fine to create all the needed files for that export set, and a
different project should be able to use those files to build against the
installed magick library and its installed coders library dependency.

I have used this EXPORT idea to allow our PLplot examples to have an
independent CMake-based build system of their own which builds those
examples against the installed core PLplot libraries, and it works like a
charm.

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 libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to