Can't call `target_include_directories` on custom target
I have a custom target which generates an include file. I wanted to add the directory containing the header file to the include directories of any target that depends on the custom target, but I get the error target_include_directories called with non-compilable target type
.
Here is an example of what I am trying to do:
add_custom_target(my_h
COMMAND xxd -i $<TARGET_FILE:my_bin> my_bin.h
DEPENDS my_bin
VERBATIM
)
target_include_directories(my_h INTERFACE ${CMAKE_CURRENT_BINARY_DIR})