View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015299CMakeModulespublic2014-12-11 06:362016-06-10 14:31
ReporterPaweł Stankowski 
Assigned ToKitware Robot 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0015299: CMakeExpandImportedTargets does not support generator expression TARGET_PROPERTY w/o target specified
DescriptionCMakeExpandImportedTarget expands target names to file paths including targets from IMPORTED_LINK_INTERFACE_LIBRARIES* properties of expanded targets.

However, IMPORTED_LINK_INTERFACE_LIBRARIES property may contain generator expression $<TARGET_PROPERTY:prop>. It should be converted to $<TARGET_PROPERTY:target,prop> expression. Otherwise following error will appear:

"$<TARGET_PROPERTY:prop> may only be used with targets. It may not be used
  with add_custom_command. Specify the target to read a property from using
  the $<TARGET_PROPERTY:tgt,prop> signature instead".

BTW: INTERFACE_LINK_LIBRARIES property should be preferred, IMPORTED_LINK_INTERFACE_LIBRARIES should not be used when the former is defined. Currently INTERFACE_LINK_LIBRARIES property is ignored.
Steps To ReproduceThis is easily reproducible on Windows with Qt libraries.

For example, Qt5 adds following generator expression in IMPORTED_LINK_INTERFACE_LIBRARIES of Qt targets:
$<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>,$<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>,$<NOT:$<BOOL:$<TARGET_PROPERTY:Qt5_NO_LINK_QTMAIN>>>,$<TARGET_POLICY:CMP0020>>:Qt5::WinMain>;C:/Qt5/5.3/msvc2013_opengl/bin/Qt5Networkd.dll;C:/Qt5/5.3/msvc2013_opengl/bin/Qt5Cored.dll;$<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>,$<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>,$<NOT:$<BOOL:$<TARGET_PROPERTY:Qt5_NO_LINK_QTMAIN>>>,$<TARGET_POLICY:CMP0020>>:Qt5::WinMain>

Qt4 does similar thing.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0037444)
Brad King (manager)
2014-12-11 10:52

This module has been superseded in CMake 3.x by the LINK_LIBRARIES option to try_compile which knows how to handle imported targets.
(0037445)
Paweł Stankowski (reporter)
2014-12-12 06:48

Yeah, but this module is still useful for me for CPack automation.

My case is that I want to install my main executable together will all its dependencies, which are mainly Qt5 imported targets. At first I tried:
  install(TARGETS ${DEPENDENCIES} ...)
but this does not work for imported targets.

So I use CMakeExpandImportedTarget module to translate imported target names to file paths and then run:
  install(PROGRAMS ${CMakeExpandImportedTarget_OUTPUT} ...)
and it works nicely if only I delete INTERFACE_LINK_LIBRARIES from Qt targets.

Can you suggest any alternative for installing imported targets to pack them using CPack? If not, I would be glad if you undeprecate this module.
(0037446)
Brad King (manager)
2014-12-12 08:33

Re 0015299:0037445: The BundleUtilities module has code to find runtime dependencies for packaging.

Also since CMake 3.0 the install(FILES) and install(PROGRAMS) commands accept generator expressions in the list of files to be installed.
(0042687)
Kitware Robot (administrator)
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.

 Issue History
Date Modified Username Field Change
2014-12-11 06:36 Paweł Stankowski New Issue
2014-12-11 10:52 Brad King Note Added: 0037444
2014-12-12 06:48 Paweł Stankowski Note Added: 0037445
2014-12-12 08:33 Brad King Note Added: 0037446
2016-06-10 14:29 Kitware Robot Note Added: 0042687
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team