Genex: TARGET_PROPERTY on POSITION_INDEPENDENT_CODE returns 0 instead of NOTFOUND
I was trying to set a value only if POSITION_INDEPENDENT_CODE
is not set, but the TARGET_PROPERTY
returns 0
instead of NOTFOUND
when a property does not exist.
This is a problem because I do not want this default value is the user actually set the value to something evaluating to False
except in the case where it is NOTFOUND
(handled separately).
For example:
get_target_property(target_POSITION_INDEPENDENT_CODE ${targetname} POSITION_INDEPENDENT_CODE)
message(STATUS target_POSITION_INDEPENDENT_CODE=${target_POSITION_INDEPENDENT_CODE})
will print
-- target_POSITION_INDEPENDENT_CODE=target_POSITION_INDEPENDENT_CODE-NOTFOUND
and "POSITION_INDEPENDENT_CODE=$<TARGET_PROPERTY:${targetname},POSITION_INDEPENDENT_CODE>"
used in add_custom_command
will be transformed to POSITION_INDEPENDENT_CODE=0
.
Since the $<BOOL:>
already handles the NOTFOUND case, would it be possible to make TARGET_PROPERTY
return the correct thing ? Or at least have a HAS_PROPERTY
generator expression ?
Edited by Brad King