[cmake-developers] [CMake 0014786]: Imported targets always require an IMPORTED_LOCATION

Mantis Bug Tracker mantis at public.kitware.com
Wed Mar 5 08:06:16 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14786 
====================================================================== 
Reported By:                Philipp Möller
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14786
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-03-05 08:06 EST
Last Modified:              2014-03-05 08:06 EST
====================================================================== 
Summary:                    Imported targets always require an IMPORTED_LOCATION
Description: 
When creating an imported target "importtarget" and not setting the
IMPORTED_LOCATION property, targets linking against the imported target will
have a dependency on importtarget-NOTFOUND, making it impossible to build.

A common use case is to manually create imported targets from the result of a
find_package call for easy reference to the dependency in various places in the
build system. Some libraries (like core Boost, Eigen) don't have any libraries. 


Steps to Reproduce: 
Use:

cmake_minimum_required(VERSION 2.8)
project(Foo)

add_executable(main main.cpp)

add_library(Header_only_lib IMPORTED)
set_target_properties(${lib} PROPERTIES 
  INTERFACE_INCLUDE_DIRECTORIES "/usr/include/my_lib"
  )
target_link_libraries(main Header_only_lib)

cmake .
make main # boom

Additional Information: 
AFAIK this is going to be resolved with add_library(foo INTERFACE IMPORTED), but
a work-around for earlier CMake versions would be much appreciated. 
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-03-05 08:06 Philipp Möller New Issue                                    
======================================================================



More information about the cmake-developers mailing list