Getting property on INTERFACE_LIBRARY targets fails
I have some code that walks through each link library of a target:
get_target_property(libraries ${_name] LINK_LIBRARIES)
foreach(lib ${libraries})
get_target_property(config ${lib} CONFIG_FILE)
if(config)
# ...
endif()
endforeach()
That works great. Except get_target_property
, when called on an INTERFACE_LIBRARY
, is a hard error:
INTERFACE_LIBRARY targets may only have whitelisted properties. The
property "CONFIG_FILE" is not allowed.
But I'm not trying to add a property, I'm trying to retrieve a property. Why not just return back an empty property instead? As a workaround, I first have to check the TYPE
- which seems totally unnecessary. This is with cmake 3.10.
Edited by Jörg Bornemann