CMAKE and compiler defines
Posted: Wed Jan 26, 2022 8:47 pm
I think I have a concept error and I could use some knowledge...
I have an idf project with the following structure (ish):
components
--component_1
----CMakeLists.txt
----sourc.cpp
--component_2
----CMakeLists.txt
----sourc.cpp
main
--main.cpp
--CMakeLists.txt
CMakeLists.txt
sdkcofig
My components require some processor defines and so in the top level CMakeLists.txt I do something like this:
Now, if i check the build.ninja file the DEFINES variable in the
#############################################
# Order-only phony target for my_amazing_project.elf
has the correct defines...but these defines dont seem to be making it to the components (the compile command line output only has the -DESP_PLATFORM and version define set)
Do I need to set these defines some other way or at some other level in the cmake lists?
Thanks!
I have an idf project with the following structure (ish):
components
--component_1
----CMakeLists.txt
----sourc.cpp
--component_2
----CMakeLists.txt
----sourc.cpp
main
--main.cpp
--CMakeLists.txt
CMakeLists.txt
sdkcofig
My components require some processor defines and so in the top level CMakeLists.txt I do something like this:
Code: Select all
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(my_amazing_project)
add_compile_definitions(
"DO_THING_A"
"ENABLE_AWESOMENESS"
)
message(STATUS "Building: root")
#############################################
# Order-only phony target for my_amazing_project.elf
has the correct defines...but these defines dont seem to be making it to the components (the compile command line output only has the -DESP_PLATFORM and version define set)
Do I need to set these defines some other way or at some other level in the cmake lists?
Thanks!