UNKNOWN IMPORTED targets cannot have properties set using target_* commands
Let's say I'm writing a Find Module for an external package. Somewhere in the module I create the imported target:
add_library(MyLib UNKNOWN IMPORTED)
MyLib
requires that some compile definitions be defined, so I want to call target_compile_definitions
on it:
target_compile_definitions(MyLib INTERFACE "SOME_FOO")
But I get an error:
target_compile_definitions called with non-compilable target type
I can still set the property directly via set_target_properties
though:
set_target_properties(MyLib PROPERTIES
IMPORTED_LOCATION "${MyLib_LIBRARIES}"
INTERFACE_COMPILE_OPTIONS "SOME_FOO")
Practically I don't see any reason why UNKNOWN IMPORTED
targets have any restrictions on their properties. After all - they are designed to specifically convey usage requirements.