On Wed, Sep 21, 2011 at 11:45 AM, Lori Pritchett-Sheats
<lpri...@lanl.gov> wrote:
> Reading the documentation it is not clear how the DEPENDS option works in
> ExternalProject_Add.
>
> For example, I add HDF5 to my build and HDF5 depends on zlib the following
> doesn't work
>
> find_package(ZLIB)
> add_library(zlib UNKNOWN IMPORTED)
> set_target_properties(zlib PROPERTIES IMPORTED_LOCATION ${ZLIB_LIBRARY})
>
> ExternalProject_Add(hdf5 DEPENDS zlib ......)
>
> throws an error with the message 'No rule to make /zlib-done', needed by
> external_projects/src/hdf5-stamp/hdf5-configure
>
> For ExternalProject_Add, are the targets listed under the DEPENDS option
> only targets that will be built with another ExternalProject_Add, not
> existing libraries?
>

That's correct.

The first argument to ExternalProject_Add does become the name of a
custom target, though. So after the ExternalProject_Add call, you can
do:

ExternalProject_Add(hdf5 ...)

add_dependencies(hdf5 zlib)

However, in this particular case, you are finding an existing zlib and
then using an imported target to say where it is *for other
non-external project targets in the same CMake build*... For the
ExternalProject build of hdf5, you're going to have to pass down in
the location of zlib via some arguments, because the ExternalProject
build knows nothing about the context of what else is built in the
current CMake build...

So in this particular case, the hdf5 custom target does not actually
depend (in a build order sense) on the zlib target -- because the zlib
target doesn't build anything, it's just imported. So you don't
actually need the dependency... you just need to tell hdf5 where zlib
is.

Does that make sense?


HTH,
David


>
>
> --
> Lori A. Pritchett-Sheats, PhD.
> CCS-2, Computational Physics and Methods
> Office: 505-665-6675
> Fax: 505-665-4972
>
> Los Alamos National Laboratory
> P.O. Box 1663
> MS D413
> Los Alamos, NM 87544
>
> _______________________________________________
> 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
>
_______________________________________________
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