Reputation: 63
I have a C++ project using autotools for compiling under a Linux environment. All includes path i wrote in were relative (ex : -I../path0/inc -I../path1/path2/inc -I../../../path3/inc).
Everything was fine until i decide to build my project in tree-build directory because all object files were among the source ones.
Of course, compilation does not work anymore as i expected.
So, there are my questions :
Upvotes: 1
Views: 1201
Reputation: 180151
- Do i have to add myself @srcdir@ in front of each include ? (ex: AM_CPPFLAGS = -I@srcdir@/path0/inc -I@srcdir@/../path1/inc)
- Or what is the good way to do this ?
To properly support out-of-tree building, yes, you need to explicitly express include directories relative to the source directory. Also any other source-tree paths in command-line arguments, except only those expressed via make
automatic variables representing prerequisites of the rule.
Personally, however, I prefer to use the $srcdir
and / or $top_srcdir
variable provided by Automake instead of the @srcdir@
substitution from Autoconf.
Upvotes: 1