I am working on a project where we need to find the internal dependencies of a C/C++ project. To do so, I need to find the include paths for each source directory of the project.
If the project is built with a Makefile then I can use make -n
to know exactly which -I
options are used for what file.
If the project is instead built with a CMakeLists.txt file then I have no idea on how to proceed. CMake uses
include_directories([AFTER|BEFORE] [SYSTEM] dir1 [dir2 ...]) # OR....
target_include_directories(<target> [SYSTEM] [BEFORE]
<INTERFACE|PUBLIC|PRIVATE> [items1...]
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...]))
to denote what include directories to use, but excluding the trivial case where the directory is specified directly, I have no idea how to find the include paths.
So my question is, does anyone know how to extract the include paths used for each folder/file from a CMakeLists.txt?
Thanks!