So I have the following setup (simplified version):
application/app1.hpp
application/app1.cpp
application/utils/utils1.hpp
application/utils/utils1.cpp
So when I compile app1.cpp I do so like this (this is a cut-down version of the compile):
g++ -Wall -Wextra -Werror -I application -isystem application/utils -MMD -MP -MF dep.d -c application/app1.cpp -o obj.o
Where I use -MDD to auto generate dependency information. I use -isystem to inhibit warnings from files in utils folder.
Note: that utils
is a sub-module (i.e. a seperate project that compiles on its own). Therefore I don't want compile warnings/errors from that project. Therefore I am using -isystem application/utils
to include folders. When you use isystem you don't get gcc warnings - which is great :)
However I just discovered that this is also the reason I am not getting complete depenecy outputs. Files included in the isystem
directories are not added as dependecies in the gcc generated dep.d file.
So it seems I can either ignore the warnings from utils but not get depenency generation for it OR I can get the dependency output but not ignore the warnings.
I really want both:
- No warnings from utils
- Dependencies from utils folder (via gcc's -MMD)
Is that possible to get both behaviours somehow?
Some ideas of mine:
- I was thinking of somehow running the dependency pre-processor part on its own first and then the compile... but I did not see a way to do that
- Force include folders in the MMD part. I found that I can include specific files with
-include
but not folders and I don't have a list of files :(