0

I'm using add_cusmtom_target to do a custom build, but what properties of this target have? Perticually how can I get the list of dependencies listed in the target:

add_custom_target(exsdk COMMAND echo DEPENDS foo.jar bar.jar)

get_target_property(D exsdk DEPENDS)

exsdk is not found, how can I get the properties of custom target?

ilya1725
  • 4,496
  • 7
  • 43
  • 68
fluter
  • 13,238
  • 8
  • 62
  • 100
  • DEPENDS is not a valid property on any target, not just custom targets: https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#properties-on-targets. It isn't possible to query the dependencies of a target in this way. – digby280 Jul 19 '20 at 10:49
  • [That question](https://stackoverflow.com/questions/62965596/how-to-append-sources-to-custom-target) (and its answer) suggests that list of files, from which custom command depends, is stored in the SOURCES property. – Tsyvarev Jul 19 '20 at 11:45
  • Based on the man page for the [get_target_property](https://cmake.org/cmake/help/latest/command/get_target_property.html) `D` is the name of the variable where the value of the property will be stored – ilya1725 Aug 31 '23 at 17:11
  • I cannot reproduce. `exsdk` is found and the code properly executes, the value of `D` is `D-NOTFOUND`, because there is no such property as `DEPENDS`. The code showed works properly. Target has any set properties, a custom target may have no properties. – KamilCuk Aug 31 '23 at 17:23

0 Answers0