idf_component register conditionals
Posted: Sat Nov 22, 2025 7:33 pm
Is there a way to add a conditional REQUIRES statement in a idf_components_register statement in CMakeLists.txt using a configuration declaration.
in CMakeLists.txt the following statement exists
idf_component_register(SRCS "LedManager.c"
REQUIRES LibGpio LibTypes CommandLineInterface
INCLUDE_DIRS "include")
I would like to make the CommandLineInterface requirement a conditional based on a configuration parameter
CONFIG_LEDMANAGER_ENABLE_DEBUG_COMMANDS
in CMakeLists.txt the following statement exists
idf_component_register(SRCS "LedManager.c"
REQUIRES LibGpio LibTypes CommandLineInterface
INCLUDE_DIRS "include")
I would like to make the CommandLineInterface requirement a conditional based on a configuration parameter
CONFIG_LEDMANAGER_ENABLE_DEBUG_COMMANDS