How do I stop automake from adding -I. to my compile line?
Question
How do I stop automake from adding -I. to my compile line?
It seems automake or libtool objects always have a compile command similar to:
g++ -DHAVE_CONFIG_H -I. -I./proj/otherdir -o myprog.o myprog.c
The problem is that I have two header files with the same name....
./proj/otherdir/Header.h
./proj/thisdir/Header.h
Each header has a class named Header, although each is in a different namespace. So when I am building in ./proj/thisdir, the "-I." gets included and I can't get to the header in ./proj/otherdir
I don't know how to get rid of that initial "-I." that appears.
Any hints?
Thanks Chenz
Solution
all you have to do is set in the Makefile.am
DEFAULT_INCLUDES =
and then all is good in the world.
Chenz
OTHER TIPS
If your API includes different headers when I write
#include <Header.h>
that makes that API confusing and error prone.
Why not define your API like
#include <thisdir/Header.h>
and
#include <otherdir/Header.h>
Then you could even refer to both headers in the same source file if required. And you would know just from reading the include line what it actually includes.
Look in the configure.ac or configure.in for your app, should be in there
It doesn't get rid of -I., but you can put relative paths in your #include
directives:
#include "../otherdir/Header.h"
#include "../thisdir/Header.h"