Skip to content

Commit 5d7091a

Browse files
committed
Optionally link M5Unified to enable the I2C_Class adapter on ESP-IDF
1 parent 26801ad commit 5d7091a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,10 @@ idf_component_register(
1919
REQUIRES driver M5HAL
2020
PRIV_REQUIRES esp_adc esp_timer M5Utility
2121
)
22+
23+
# Optionally link M5Unified only when it is already part of the build (e.g. a M5Unified-based
24+
# app or example). This puts M5GFX's <utility/I2C_Class.hpp> on adapter_i2c.cpp's include path,
25+
# so the real m5::I2C_Class adapter is compiled instead of the stub. Pure ESP-IDF builds without
26+
# M5Unified are unaffected (the component is simply skipped). Available since IDF v5.0.
27+
# Both names are listed: m5stack__M5Unified (registry/git) and M5Unified (local components/).
28+
idf_component_optional_requires(PRIVATE m5stack__M5Unified M5Unified)

0 commit comments

Comments
 (0)