From ae7173d4d5fce0d6b037b666413a2496ff8082e8 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 3 Nov 2021 17:23:56 +0100 Subject: [PATCH] cmake: error out of IDF version is outside of supported range --- CMakeLists.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 895ac4213..59d1ded8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,27 @@ +# Check ESP-IDF version and error out if it is not in the supported range. +# +# Note for arduino-esp32 developers: to bypass the version check locally, +# set ARDUINO_SKIP_IDF_VERSION_CHECK environment variable to 1. For example: +# export ARDUINO_SKIP_IDF_VERSION_CHECK=1 +# idf.py build + +set(min_supported_idf_version "4.4.0") +set(max_supported_idf_version "4.4.99") +set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}") + +if ("${idf_version}" AND NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}") + if (idf_version VERSION_LESS min_supported_idf_version) + message(FATAL_ERROR "Arduino-esp32 can be used with ESP-IDF versions " + "between ${min_supported_idf_version} and ${max_supported_idf_version}, " + "but an older version is detected: ${idf_version}.") + endif() + if (idf_version VERSION_GREATER max_supported_idf_version) + message(FATAL_ERROR "Arduino-esp32 can be used with ESP-IDF versions " + "between ${min_supported_idf_version} and ${max_supported_idf_version}, " + "but a newer version is detected: ${idf_version}.") + endif() +endif() + set(CORE_SRCS cores/esp32/base64.cpp cores/esp32/cbuf.cpp