Page 1 of 1

Target-specific cmake build?

Posted: Fri Dec 09, 2022 3:02 pm
by dizcza
Is it possible to add a component 'foo' only for ESP32 and exclude it from requirements if the target is set to ESP32-S3? Also include and exclude source files?

Code: Select all

#if CONFIG_IDF_TARGET_ESP32
file (GLOB SOURCES *.c)
idf_component_register(SRCS ${SOURCES}
                       INCLUDE_DIRS "."
                       REQUIRES driver foo)
#else  // S3
idf_component_register(SRCS "bar.c"
                       INCLUDE_DIRS "."
                       REQUIRES driver)
#endif

Re: Target-specific cmake build?

Posted: Mon Dec 12, 2022 12:15 am
by chegewara

Re: Target-specific cmake build?

Posted: Mon Dec 12, 2022 8:13 am
by dizcza
Nice! That's exactly what I was looking for. Thanks.