pseyfert
pseyfert

Reputation: 3613

distinguish include_directories with and without the 'SYSTEM' option in cmake

I am using get_property( … PROPERTY INCLUDE_DIRECTORIES) for debugging in a CMake project. Is there a way to tell which of the include directories have been done with and without the SYSTEM option?

In the following example I see no difference

include_directories("../B")
include_directories(SYSTEM "../A")

get_property( reqs TARGET main PROPERTY INCLUDE_DIRECTORIES)
message(STATUS "main requires ${reqs}")

prints:

-- main requires /home/pseyfert/coding/system/C/../B;/home/pseyfert/coding/system/C/../A

Upvotes: 1

Views: 133

Answers (1)

Tsyvarev
Tsyvarev

Reputation: 66061

There is target property INTERFACE_SYSTEM_INCLUDE_DIRECTORIES, which contains those of include directories, which has been marked as SYSTEM.


As the property's name suggests (and as noted in docs), INTERFACE_SYSTEM_INCLUDE_DIRECTORIES contains only INTERFACE directories, which are propagated to the targets linked with given one. It is unclear from CMake docs, how PRIVATE include directories should be distinguished.

Upvotes: 1

Related Questions