Skip to content

Commit c5dd39d

Browse files
committed
cmake: error out of IDF version is outside of supported range
1 parent caa8d07 commit c5dd39d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Diff for: CMakeLists.txt

+25
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# Check ESP-IDF version and error out if it is not in the supported range.
2+
#
3+
# Note for arduino-esp32 developers: to bypass the version check locally,
4+
# set ARDUINO_SKIP_IDF_VERSION_CHECK environment variable to 1. For example:
5+
# export ARDUINO_SKIP_IDF_VERSION_CHECK=1
6+
# idf.py build
7+
8+
set(min_supported_idf_version "4.4.0")
9+
set(max_supported_idf_version "4.4.99")
10+
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}")
11+
12+
if (NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}")
13+
message(FATAL_ERROR ${idf_version})
14+
if (idf_version VERSION_LESS min_supported_idf_version)
15+
message(FATAL_ERROR "Arduino-esp32 can be used with ESP-IDF version "
16+
"${supported_idf_version}, but an older version is "
17+
"detected: ${idf_version}.")
18+
endif()
19+
if (idf_version VERSION_GREATER max_supported_idf_version)
20+
message(FATAL_ERROR "Arduino-esp32 can be used with ESP-IDF version "
21+
"${supported_idf_version}, but a newer version is "
22+
"detected: ${idf_version}.")
23+
endif()
24+
endif()
25+
126
set(CORE_SRCS
227
cores/esp32/base64.cpp
328
cores/esp32/cbuf.cpp

0 commit comments

Comments
 (0)