I try to create .d and .o files from c files using minGW makefiles. I have list of header files in different folder path. Confused whether to use include_directories / target_include_directories
Prefer target_include_directories
as this applies to targets and can be inherited via usage requirements. include_directories
adds the paths to all targets defined after it in the same and any subdirectories.
Syntax:
target_include_directories(
name_of_target_needing_include
PUBLIC
/path/needed/by/this/target/and/any/using/it # (for example, headers from here are included by your own public headers)
PRIVATE
/path/needed/only/by/this/target # (only included in sources or private headers)
INTERFACE
/path/needed/only/by/using/targets # (not needed by your sources, but are in your headers; generally only used for header-only targets)
)