[CMake] Why is XXX_INCLUDE_DIRS plural and should it be deep?
Rolf Eike Beer
eike at sf-mail.de
Thu Dec 13 01:50:19 EST 2012
esatel wrote:
> 2. The other sets a similar variable but then does find_package on HDF5 and
> loads the dependencies into NetCDF_INCLUDE_DIRS and NetCDF_LIBRARIES.
>
> This design (2) cascades. FindHDF5.cmake represents a similar decision about
> whether to find_package its dependencies like the zlib compression library.
> I believe the one in the cmake distro doesn't do that.
>
> What is the best practice here? To handle dual locations for the library at
> hand or to accumulate or both? The first seems unavoidable ... the second
> seems to be an unevenly applied standard.
My personal vote on this is: if the public headers of package X include
headers from one of it's dependencies then you should cascade. So if
<netcdf.h> does
#ifdef WITH_HDF5
#include <hdf5.h>
#endif
then you would get a compile error if the HDF5 include directories are not
set. If this is just an internal dependency or you would explicitely need to
include e.g. netcdf/hdf5.h to get that sort of stuff then I would vote for not
becoming recursive. Which is a "sane" default as most packages will not need
that recursive approach then.
Eike
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121213/2720f853/attachment-0001.pgp>
More information about the CMake
mailing list