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
idf_component register conditionals
-
nopnop2002
- Posts: 347
- Joined: Thu Oct 03, 2019 10:52 pm
- Contact:
Re: idf_component register conditionals
Code: Select all
set(reqs "LibGpio LibTypes")
if(CONFIG_LEDMANAGER_ENABLE_DEBUG_COMMANDS)
list(APPEND reqs "CommandLineInterface")
endif()
idf_component_register(SRCS "LedManager.c"
REQUIRES "${reqs}"
INCLUDE_DIRS "include")
Re: idf_component register conditionals
Unfortunately, this is not possible in the current build system.Code: Select all
set(reqs "LibGpio LibTypes") if(CONFIG_LEDMANAGER_ENABLE_DEBUG_COMMANDS) list(APPEND reqs "CommandLineInterface") endif() idf_component_register(SRCS "LedManager.c" REQUIRES "${reqs}" INCLUDE_DIRS "include")
https://docs.espressif.com/projects/es ... uirements
Build system v2 is currently being tested, where this limitation has been removed.The values of REQUIRES and PRIV_REQUIRES should not depend on any configuration options (CONFIG_xxx macros). This is because requirements are expanded before the configuration is loaded. Other component variables (like include paths or source files) can depend on configuration options.
https://docs.espressif.com/projects/es ... .html#id9
Who is online
Users browsing this forum: ChatGPT-User and 4 guests