Include file paths (-I ...)
Geert Janssens
janssens-geert at telenet.be
Fri Sep 27 08:29:05 EDT 2013
While working on the preferences migration I had to introduce two source files that are
generated during compilation.
These files are generated in the build directory (if building out-of-tree). Without any changes to
the include paths in the makefiles, this results in a build error (source not found).
I looked a bit closer and found that we are specifying the include search paths as absolut paths
from the $(top_srcdir), like
-I$(top_srcdir)/src/gnome-utils, ...
Obviously with such a path spec my built source files in the build directory never get found.
If I change the above to
-I../gnome-utils
(this example is for in the gnome/Makefile.am), it works. That is because the compiler will
expand this path in both the source dir as the build dir.
So my question: is that the right approach and secondly, why was the $(top_srcdir) notation
chosen in the first place ?
Note that there were already built sources in the gnucash code. These are included using a
path relative to src, for example
#include "core-utils/gnc-version.h"
and the relevant Makefile.am has a pathspec like
-I$(top_builddir)/src
Seems ... inconsistent ? Or what am I missing ?
Geert
More information about the gnucash-devel
mailing list