[SOLVED] IDF ver 4.4 & 5 compatibility in CMakeFiles
Posted: Thu Aug 25, 2022 7:33 pm
Dear developers,
Can someone point me to an smart way to keep a CMakeFiles compatible for those who want to build also a project in ESP-IDF v5. But of course keeping backwards compatibility to 4.4 at least. I searched for CMakeFiles and IDF_VERSION but didn't found anything related. Please forgive me if it was asked before
IDEA (I know pre-processor directives won't work but just to illustrate it)
So I could for example use the new esp_adc but still keep the old esp_adc_cal. Is there any smart way to tell CMake, hey if Framework version is major than X, then include this component, or if not then add this other component.
Without this keeping Firmware's that might be compiled in either IDF 4.4 or 5 will be a real pain to maintain.
Can someone point me to an smart way to keep a CMakeFiles compatible for those who want to build also a project in ESP-IDF v5. But of course keeping backwards compatibility to 4.4 at least. I searched for CMakeFiles and IDF_VERSION but didn't found anything related. Please forgive me if it was asked before
IDEA (I know pre-processor directives won't work but just to illustrate it)
Code: Select all
idf_component_register(SRCS ${app_sources}
INCLUDE_DIRS "include"
REQUIRES esp_timer
#if IDF_VERSION > 5.0
driver esp_adc
#else
esp_adc_cal
#endif
)
Without this keeping Firmware's that might be compiled in either IDF 4.4 or 5 will be a real pain to maintain.