MantisBT - CMake
View Issue Details
0015689CMakeCMakepublic2015-08-07 15:172016-06-10 14:31
James Johnston 
Kitware Robot 
normalfeaturealways
closedmoved 
Windows 7
CMake 3.3 
 
0015689: Allow target_include_directories to specify INTERFACE for IMPORTED targets
When target_include_directories is used with an INTERFACE option on an IMPORTED target, the command fails with an error.

Since I specified INTERFACE and not PUBLIC or PRIVATE, I should expect the command to work without error on the IMPORTED target.

As a workaround, I have to use the more verbose set_property command.
add_library(MyLib SHARED IMPORTED)
set_property(TARGET MyLib PROPERTY IMPORTED_LOCATION mylib.dll)
set_property(TARGET MyLib PROPERTY IMPORTED_IMPLIB mylib.lib)

# Following line fails with an error:
target_include_directories(MyLib INTERFACE mylib/include)
# The error is:
# Cannot specify include directories for imported target "MyLib".
# Alternative command that works:
# set_property(TARGET MyLib APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES mylib/include)
No tags attached.
Issue History
2015-08-07 15:17James JohnstonNew Issue
2015-08-10 08:31Brad KingSeverityminor => feature
2015-08-10 08:31Brad KingSummarytarget_include_directories INTERFACE does not work for IMPORTED targets => Allow target_include_directories to specify INTERFACE for IMPORTED targets
2015-08-10 08:32Brad KingNote Added: 0039258
2016-06-10 14:29Kitware RobotNote Added: 0042820
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0039258)
Brad King   
2015-08-10 08:32   
Currently this is as intended, but certainly we could consider making IMPORTED target INTERFACE properties settable via the target_* commands.
(0042820)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.