[cmake-developers] target_link_libraries, IMPORTED targets and SYSTEM includes

Stephen Kelly steveire at gmail.com
Thu Jul 25 09:16:42 EDT 2013


Hi,

In response to 

 https://bugreports.qt-project.org/browse/QTBUG-32599

I first considered adding something like

 if(NOT QT_INCLUDE_DIRS_NO_SYSTEM)
   set_property(TARGET Qt5::Core 
     SYSTEM_INTERFACE_INCLUDE_DIRECTORIES
     ${Qt5Core_INCLUDE_DIRS}
   )
 endif()

for each imported target, which would cause CMake to treat the includes for 
it as system includes.

Then I had the idea that I didn't like the API of

 set(QT_INCLUDE_DIRS_NO_SYSTEM 1)
 find_package(Qt5Core)

and I prefered

 find_package(Qt5Core)
 add_library(foo ...)
 target_link_libraries(foo SYSTEM Qt5::Core)

which has a similar effect as the SYSTEM keyword in 
target_include_directories.

I implemented that without a test so far in tll-system-includes-signature in 
my clone. However, the motivation for that is that I generally want to treat 
all 'external' headers as system includes, and Qt is just a common external 
dependency. 

Should we treat the INTERFACE_INCLUDE_DIRECTORIES of all IMPORTED targets as 
SYSTEM includes automatically?

Thanks,

Steve.





More information about the cmake-developers mailing list