IDF_TARGET inside custom components

vinci1989
Posts: 28
Joined: Mon Oct 08, 2018 6:07 pm

IDF_TARGET inside custom components

Postby vinci1989 » 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.

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()
/edit
Also... dependencies added by the component manager aren't transitive. :roll:

Who is online

Users browsing this forum: No registered users and 61 guests