[CMake] SubProject configuration in same build as host

Biddiscombe, John A. biddisco at cscs.ch
Thu Apr 15 05:40:18 EDT 2010


Within paraview we wish to build hdf5, which is now cmake based, so we ADD_SUBDIRECTORY(blah) and hdf5 is compiled nicely with lib targets added to the build.

Some settings (like lib names) are needed by the host project, so we want to
SET(HDF5_CONFIG ${ParaView_BINARY_DIR}/Utilities/hdf5-1.8/HDF5-config.cmake)
INCLUDE(${HDF5_CONFIG})

But this file - which is generated for us by cmake and placed in the build tree - has contents like
# Create imported target vtkhdf5
ADD_LIBRARY(vtkhdf5 SHARED IMPORTED)

And naturally if I include this inside the host project build - it complains that vtkhdf5 can't be added as an imported library as it is already a target in the main build - created when I did add_subdirectoy for the hdf5 source.

Is there a similar functionality, other than the 'old style' configure_file command to generate a bunch of settings that can be picked up by the host project. I had the impression that the new project import/export/install stuff was designed to make this sort of thing more automated, but I think I'm missing a piece of the puzzle.

thanks

JB

--
John Biddiscombe,                            email:biddisco @ cscs.ch
http://www.cscs.ch/
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100415/fc30872f/attachment.htm>


More information about the CMake mailing list