View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015362CMakeCMakepublic2015-01-19 19:442015-07-08 08:57
ReporterClinton Stimpson 
Assigned ToStephen Kelly 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in VersionCMake 3.2 
Summary0015362: Target property INTERFACE_SYSTEM_INCLUDE_DIRECTORIES doesn't seem to work
DescriptionI had some code doing
set_property(TARGET A APPEND PROPERTY
    INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")

And I replaced INTERFACE_INCLUDE_DIRECTORIES with INTERFACE_SYSTEM_INCLUDE_DIRECTORIES, and it no longer worked.

I understand the different to be equivalent to
include_directories(...)
vs.
include_directories(SYSTEM ...)


Steps To ReproduceSee attached project for an example which doesn't work.
TagsNo tags attached.
Attached Filesgz file icon test-usage-includes.tar.gz [^] (619 bytes) 2015-01-19 19:44

 Relationships

  Notes
(0037754)
Clinton Stimpson (developer)
2015-01-19 19:52

I tried CMake 3.1 initially, but also tried 2.8.12 where the feature was introduced... and it doesn't work there either.
(0037763)
Clinton Stimpson (developer)
2015-01-21 13:58

I found a way to get what I wanted.

I'm trying to add INTERFACE_INCLUDE_DIRECTORIES for an imported target, and have a way to suppress compile warnings from those header files.

CMake 3.0 and greater will do that for me automatically, which is nice.
However, for 2.8.12 users, I've added a CMake version check and I use INTERFACE_COMPILE_OPTIONS to use the -isystem flag myself.

Still, the documented INTERFACE_SYSTEM_INCLUDE_DIRECTORIES doesn't in any version of CMake I've tried. It appears to be introduced in 2.8.12, and deprecated in 3.0. The documentation doesn't reflect the state of the feature.
(0037782)
Stephen Kelly (developer)
2015-01-22 18:19

Hi,

1)

I tried this:

  add_library(iface INTERFACE)
  set_property(TARGET iface PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
    "${CMAKE_CURRENT_SOURCE_DIR}/iface"
  )
  set_property(TARGET iface PROPERTY INTERFACE_INCLUDE_DIRECTORIES
    "${CMAKE_CURRENT_SOURCE_DIR}/iface"
  )

  add_executable(main main.cpp)
  target_link_libraries(main iface)

and it works fine. Note that the only source of include directories is the INTERFACE_INCLUDE_DIRECTORIES property. The INTERFACE_SYSTEM_INCLUDE_DIRECTORIES property only specifies which of those in INTERFACE_INCLUDE_DIRECTORIES should be treated as SYSTEM. So, essentially, they have to be specified twice.

2)
Your example also works fine when the directory is specified in INTERFACE_INCLUDE_DIRECTORIES too:

  set_property(TARGET iface PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
    "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/iface>"
  )
  set_property(TARGET iface PROPERTY INTERFACE_INCLUDE_DIRECTORIES
    "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/iface>"
  )

3)

If you use target_include_directories there is no repetition:

  target_include_directories(iface SYSTEM INTERFACE
    "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/iface>"
  )

So, taking all of the above together, the feature works, but the documentation should be clarified. The source of include directories is the INTERFACE_INCLUDE_DIRECTORIES and INCLUDE_DIRECTORIES, not anything else.

4) There *is* a bug that the CONFIG generator expression does not work.

 http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=85857e6d [^]
 85857e6d Help: Clarify INTERFACE_SYSTEM_INCLUDE_DIRECTORIES documentation.

 http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee38062b [^]
 ee38062b IncludeDirectories: Respect SYSTEM flag when using CONFIG genex.
(0039032)
Robert Maynard (manager)
2015-07-08 08:57

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-01-19 19:44 Clinton Stimpson New Issue
2015-01-19 19:44 Clinton Stimpson File Added: test-usage-includes.tar.gz
2015-01-19 19:52 Clinton Stimpson Note Added: 0037754
2015-01-21 13:58 Clinton Stimpson Note Added: 0037763
2015-01-22 18:19 Stephen Kelly Note Added: 0037782
2015-01-22 18:19 Stephen Kelly Status new => resolved
2015-01-22 18:19 Stephen Kelly Fixed in Version => CMake 3.2
2015-01-22 18:19 Stephen Kelly Resolution open => fixed
2015-01-22 18:19 Stephen Kelly Assigned To => Stephen Kelly
2015-07-08 08:57 Robert Maynard Note Added: 0039032
2015-07-08 08:57 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team