Open
Description
Answers checklist.
- I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
IDF version.
v5.4.1
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
What is the expected behavior?
I have a list with all reqiered components in my project. Whith config,I like to switch some components on or off.
set (requires "esp_event")
list(APPEND requires "base")
if(DEFINED CONFIG_BLINK_ENABLED)
list(APPEND requires "blink")
endif()
set_property(GLOBAL PROPERTY requires_property ${requires})
What is the actual behavior?
Instead the ${requires} variable is empty wenn compiling the base componente. When I remove the IF statement the content of the ${requires} variabel is as expected.
Steps to reproduce.
- this compiles fine
set (requires "esp_event")
list(APPEND requires "base")
list(APPEND requires "blink")
set_property(GLOBAL PROPERTY requires_property ${requires})
- This compiles with error regardless of whether the variable is set or not
set (requires "esp_event")
list(APPEND requires "base")
if(DEFINED CONFIG_BLINK_ENABLED)
list(APPEND requires "blink")
endif()
set_property(GLOBAL PROPERTY requires_property ${requires})
- I have inserted two messages, one in this CMakeLists.txt at the main section:
set (requires "esp_event")
list(APPEND requires "base")
if(DEFINED CONFIG_BLINK_ENABLED)
message("Blink is enabled")
list(APPEND requires "blink")
endif()
set_property(GLOBAL PROPERTY requires_property ${requires})
and one in the CMakeLists.txt in the base component:
message("Requires: ${requires}")
What I found out is, without IF statement the output of the two messages is:
Blink is enabled
Requires: .....
with IF statement the output of the two messages is:
Requires:
Blink is enabled
It has changed the order of compilation and Requires is empty because blink is not compiled yet.
Build or installation Logs.
Diagnostic report archive.
No response
More Information.
No response