ESP IDF V5.1.1 Project Configuration Problem

BlackSmith40
Posts: 6
Joined: Wed Jan 25, 2023 6:19 am

ESP IDF V5.1.1 Project Configuration Problem

Postby BlackSmith40 » Tue Nov 07, 2023 5:57 pm

In my top level CMakeLists.txt file, I've added this statement to top of it

Code: Select all

add_compile_definitions(PROJECT_TYPE_A)
get_directory_property( DirDefs COMPILE_DEFINITIONS )
message( "COMPILE_DEFINITIONS TOP LEVEL = ${DirDefs}" )
I've a component under components folder and I'm trying to read COMPILE_DEFINITIONS in that components CMakeLists.txt file as below

Code: Select all

get_directory_property( DirDefs COMPILE_DEFINITIONS )
message(STATUS "COMPILE_DEFINITIONS COMPONENT LEVEL = ${DirDefs}" )
When I call idf.py reconfigure or idf.py build, I've observed an interesting behaviour. The log is as below

Code: Select all

COMPILE_DEFINITIONS TOP LEVEL = PROJECT_TYPE_A
Some Logs
....
-- ccache will be used for faster recompilation
-- Building ESP-IDF components for target esp32
-- COMPILE_DEFINITIONS COMPONENT LEVEL =
....
More Logs
-- App "<PROJECT_NAME>" version: xxxxxx-dirty
-- Adding linker script <xxxxxxxxxx>
-- Adding linker script <xxxxxxxxxx>
-- Adding linker script <xxxxxxxxxx>
-- Adding linker script <xxxxxxxxxx>
-- COMPILE_DEFINITIONS  COMPONENT LEVEL = PROJECT_TYPE_A
As you can see it's running it twice and on the first run it fails to read compile definitions and prints empty output. This causes compiler errors on my projects because when I try to build, the failure on the first call affects my build.

How can I solve this problem?

Thanks in advance!

Who is online

Users browsing this forum: No registered users and 111 guests