Target-specific cmake build?

dizcza
Posts: 56
Joined: Tue Sep 07, 2021 6:59 pm

Target-specific cmake build?

Postby dizcza » Fri Dec 09, 2022 3:02 pm

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

chegewara
Posts: 2371
Joined: Wed Jun 14, 2017 9:00 pm

Re: Target-specific cmake build?

Postby chegewara » Mon Dec 12, 2022 12:15 am


dizcza
Posts: 56
Joined: Tue Sep 07, 2021 6:59 pm

Re: Target-specific cmake build?

Postby dizcza » Mon Dec 12, 2022 8:13 am

Nice! That's exactly what I was looking for. Thanks.

Who is online

Users browsing this forum: Bing [Bot] and 86 guests