Within Android Studio, I have a directory structure like so:
App
├── CMakeLists.txt
└── src
├── foo
│ ├── CMakeLists.txt
│ ├── foo.cpp
│ └── foo.h
├── main
│ └── cpp
│ ├── CMakeLists.txt
│ └── main.cpp
└── test
├── CMakeLists.txt
└── testDriver.cpp
In main.cpp, I would like to #include "foo.h"
or even #include "fooLib/foo.h"
but It won't compile unless I #include "../../fooLib/foo.h"
. I am trying to configure CMake within android studio to allow me to use the former. I tried export, target_include_dirs, but there is something i am just not getting.
I would like to be able to refer to "fooLib/foo" from anywhere.
Inside
App/CMakeLists.txt
Now, you can use the
#include "foo.h"
anywhere without quoting its relative path.The fix is to place
include_directories(src)
withinApp/CMakeLists.txt