Notes |
|
(0037754)
|
Clinton Stimpson
|
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
|
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
|
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
|
2015-07-08 08:57
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|