MantisBT - CMake
View Issue Details
0014495CMakeCMakepublic2013-10-20 12:552014-07-31 14:06
Nick Hutchinson 
Stephen Kelly 
normalminoralways
closedno change required 
MacOS X10.8
 
 
0014495: Spurious error about non-existent INTERFACE_INCLUDE_DIRECTORIES of IMPORTED target
CMake seems to demand that the directories referenced by the INTERFACE_INCLUDE_DIRECTORIES property of an IMPORTED target can be found at configure-time. This is quite unhelpful if those directories are only generated generated as part of the build.

You get the following error:
> Imported target "XXX" includes non-existent path
>
> "YYY"
>
> in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
>
> * The path was deleted, renamed, or moved to another location.
>
> * An install or uninstall procedure did not complete successfully.
>
> * The installation package was faulty and references files it does not
> provide.

Workaround is add a `file(MAKE_DIRECTORY YYY)` command to the CMakeLists.txt file.
> cat <<-EOF > CMakeLists.txt

cmake_minimum_required(VERSION 2.8.12)
add_library(foo STATIC IMPORTED GLOBAL)
set_property(TARGET foo PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/include")

EOF

> cmake -GNinja .
No tags attached.
related to 0015052closed Kitware Robot INTERFACE_INCLUDE_DIRECTORIES does not allow non-existent directories, but INCLUDE_DIRECTORIES does 
Issue History
2013-10-20 12:55Nick HutchinsonNew Issue
2013-10-21 08:28Brad KingAssigned To => Stephen Kelly
2013-10-21 08:28Brad KingStatusnew => assigned
2013-10-21 09:42Stephen KellyNote Added: 0034187
2013-10-21 10:33Nick HutchinsonNote Added: 0034194
2013-10-21 10:37Stephen KellyNote Added: 0034196
2013-10-22 11:44Stephen KellyNote Added: 0034217
2013-10-22 11:44Stephen KellyStatusassigned => resolved
2013-10-22 11:44Stephen KellyResolutionopen => no change required
2014-03-05 09:58Robert MaynardNote Added: 0035294
2014-03-05 09:58Robert MaynardStatusresolved => closed
2014-07-31 14:06Brad KingRelationship addedrelated to 0015052

Notes
(0034187)
Stephen Kelly   
2013-10-21 09:42   
IMPORTED targets are imported from elsewhere. By definition, they are not part of your build, but they are an external dependency. Assuming the external dependency is packaged/installed correctly, all files it refers to must be present.

You seem to be creating an IMPORTED target and building something it refers to by hand? Why?
(0034194)
Nick Hutchinson   
2013-10-21 10:33   
I use ExternalProject_Add() to build third-party components and install them into the build tree. The main project can then refer to their build products via IMPORTED targets, which encapsulate their usage requirements by the various nifty INTERFACE_XXX properties added in 2.8.11/2.8.12.

Hardly an obscure use case, I would have thought.
(0034196)
Stephen Kelly   
2013-10-21 10:37   
Right. That is not an obscure use-case.

However, you need to ensure that the external project is completed before anything attempts to use it. As far as I know (I haven't used ExternalProject much ), you need to make sure your targets depend on the ExternalProject. Presumably that is responsible for creating the required directory. I presume the IMPORTED targets are created by export() or install(EXPORT) ?

That dependency ensures that when the file with the IMPORTED targets exists and is ready to use, so is the directory.
(0034217)
Stephen Kelly   
2013-10-22 11:44   
I'm sure that what is described is a dependency issue, not an issue with the INTERFACE_INCLUDE_DIRECTORIES, as such.
(0035294)
Robert Maynard   
2014-03-05 09:58   
Closing resolved issues that have not been updated in more than 4 months