[cmake-developers] [CMake 0015689]: target_include_directories INTERFACE does not work for IMPORTED targets

Mantis Bug Tracker mantis at public.kitware.com
Fri Aug 7 15:17:33 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15689 
====================================================================== 
Reported By:                James Johnston
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15689
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-08-07 15:17 EDT
Last Modified:              2015-08-07 15:17 EDT
====================================================================== 
Summary:                    target_include_directories INTERFACE does not work
for IMPORTED targets
Description: 
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.

Steps to Reproduce: 
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)
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-08-07 15:17 James Johnston New Issue                                    
======================================================================



More information about the cmake-developers mailing list