The component define various macros depending upon the value of a compiler option that is normally set via CPPFLAGS.
This is building fine using make under MSYS32, but want to transition to CMake so I can use CLion as IDE.
Have read https://docs.espressif.com/projects/esp ... ompilation
But after trying many different combos, while I can convince the IDE that the compiler option has been set, building on the command line with "idf.py build" doesn't pass the option to the compiler.
The compiler option is "ESP32", I have tried all of the below in the CMakeLists.txt for both component and project:
Code: Select all
# Trying to configure CPPFLAGS with -DESP32 so that ArduinoWebSocket uses the correct macros.
# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system-cmake.html#controlling-component-compilation
component_compile_options("-DESP32")
component_compile_definitions("-DESP32")
set_source_files_properties(src/WebSockets.h PROPERTIES COMPILE_FLAGS -DESP32)
# https://cmake.org/cmake/help/v3.5/command/target_compile_options.html
# https://cmake.org/cmake/help/v3.5/command/target_compile_definitions.html#command:target_compile_definitions
target_compile_definitions(arduinoWebsockets PRIVATE "-DESP32")
# https://cmake.org/cmake/help/v3.5/command/add_definitions.html#command:add_definitions
add_definitions(-DESP32)