ESP32 IDF with CMake Error


Problem ☞ CMake Errors

When you encounter "include($ENV{IDF_PATH}/tools/cmake/project.cmake)" related errors when using CMake in ESP32 IDF, it may be caused by the "IDF_PATH" environment variable problem, as shown below...
CMake Error at CMakeLists.txt:5 (include):include could not find requested file:/tools/cmake/project.cmakeCMake (include)
CMake Error

Check ☞ IDF_PATH Environment Variable

Verify that the IDF_PATH variable is correctly set in the project's CMakeLists.txt file. The following command can be used...
echo $IDF_PATH

Add ☞ IDF_PATH Environment Variable

The following commands can be added to the environment variables, such as adding the following commands to the .zshrc file in MacOS...
export IDF_PATH=~/esp/esp-idf
CMake Error