IDF_TARGET inside custom components
Posted: Thu Feb 23, 2023 8:01 am
I've written a custom component which needs to check the IDF_TARGET preprocessor definition to conditionally compile different sources. It seems though that IDF_TARGET does not get passed on to components... Is this a bug?
The component I've written gets added by the component manager, in case that makes any difference.
/edit
Ok, apparently this has to be added manually... That's annoying.
/edit
Also... dependencies added by the component manager aren't transitive.
The component I've written gets added by the component manager, in case that makes any difference.
/edit
Ok, apparently this has to be added manually... That's annoying.
Code: Select all
if(ESP_PLATFORM)
file(GLOB_RECURSE SRC src/*.c)
idf_component_register(SRCS ${SRC} INCLUDE_DIRS include REQUIRES driver)
idf_build_get_property(TGT IDF_TARGET)
string(TOUPPER ${TGT} TGT)
target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_IDF_TARGET_${TGT})
endif()
Also... dependencies added by the component manager aren't transitive.