[Dune-devel] [Dune] dune & cmake
Martin Rückl
mrueckl at physik.hu-berlin.de
Wed Apr 27 14:18:51 CEST 2016
Hey,
Since i kind of came up with this whole discussion, i just want to share
my thoughts again.
First, i think, this http://stackoverflow.com/questions/28637542/
<http://stackoverflow.com/questions/28637542/ensure-config-h-is-included-once/28637797#28637797>
is a pretty good post about the issue. Second, I will just copy paste
what i think should be kept in mind:
1. Ususally config.h is only required for building the library and will
not be exposed to the user (i.e. will not be installed). That
requires that the library interface does not depend on the config.h
file. This implies, that usage of #defines from the config.h files
may only occur within the libraries compiled .cpp files.
2. Heavy use of template tends to result in code moved from .cpp to
.hpp files. Hennce, in DUNE, lots of the interface itself depends on
the variables set during configuration stage.
As pointed out in the SO post, there seems to be no proper solution for
#2. As mentioned, Eigen3 solves it by putting e.g. its own version
information into a header file which ships with the installation and is
included by other header files from the library.
From the library user point, Ansgars proposal seems to be the correct
way. There, each module can have its own defines of type #2
(DUNE_B_HAVE_MPI) and those can ship in a header file which can be
included by other headers from the library without "messing up the
global define namespace".
HtH Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20160427/f9d0537d/attachment.htm>
More information about the Dune-devel
mailing list