[cmake-developers] [CMake 0014899]: $<TARGET_PROPERTY:prop> with add_custom_target does not work

Mantis Bug Tracker mantis at public.kitware.com
Mon Apr 28 08:22:09 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14899 
====================================================================== 
Reported By:                Kiron
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14899
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-04-28 08:22 EDT
Last Modified:              2014-04-28 08:22 EDT
====================================================================== 
Summary:                    $<TARGET_PROPERTY:prop> with add_custom_target does
not work
Description: 
When using the $<TARGET_PROPERTY:FOO> generator expression inside an
add_custom_target command the following error is produced:

CMake Error at CMakeLists.txt:6 (add_custom_target):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:FOO>

  $<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.

I would expect that with add_custom_target command the short hand form should
work (like error message says already, ... may only be used with targets).

Steps to Reproduce: 
Save this as a CMakeLists.txt and run cmake:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

project(Foo NONE)

add_custom_target(foo
    COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:FOO>
)

set_property(TARGET foo PROPERTY FOO "foobar")


Additional Information: 
Problem exists with cmake version 2.8.12.1, 3.0.20140422-g9f9532, and 
3.0.20140424-gb4aa99
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-04-28 08:22 Kiron          New Issue                                    
======================================================================



More information about the cmake-developers mailing list