Difference between platforms in global ${CMAKE_CXX_FLAGS} defintion.

CvR_XX
Posts: 3
Joined: Thu Oct 21, 2021 9:39 am

Difference between platforms in global ${CMAKE_CXX_FLAGS} defintion.

Postby CvR_XX » Thu Oct 21, 2021 9:47 am

I'm trying to set some C++ flags for all the components I'm using.

I've succeeded by adding set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSOMEFLAG") to the CMakeLists.txt in the main folder. This compiles perfectly and all components see the define SOMEFLAG. Idf.py --version outputs: ESP-IDF v4.3.1.

Now it gets interesting. When I compile the exact same code in the esp-idf docker container the build fails because the defines are not found in the other components. If I run Idf.py --version here it outputs: ESP-IDF v4.3.1-dirty.

What could cause this? How can I add defines so that they would also be found by the components in the docker container?

Thanks in advance!

Carlos

CvR_XX
Posts: 3
Joined: Thu Oct 21, 2021 9:39 am

Re: Difference between platforms in global ${CMAKE_CXX_FLAGS} defintion.

Postby CvR_XX » Fri Oct 22, 2021 9:12 am

I can now reproduce it on both platforms. The questions which remains is how should I declare flags that should go to every component?

ESP_Dazz
Posts: 308
Joined: Fri Jun 02, 2017 6:50 am

Re: Difference between platforms in global ${CMAKE_CXX_FLAGS} defintion.

Postby ESP_Dazz » Sat Oct 23, 2021 6:33 am

The build system in ESP-IDF isn't vanilla CMake as there are a lot of feature that are wrapped on top and exposed as commands and properties.

Try the idf_build_set_property() command where you target the CXX_COMPILER_OPTIONS property with an append option.

Who is online

Users browsing this forum: JVKran and 129 guests