question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find CMAKE_ROOT on Windows

See original GitHub issue

Hello, I’m pretty new to PlatformIO, I’m just using it to test a project I’ve found on another repository. So this might be just a misconfiguration on my part, but I can’t find how to fix it in the docs or the IDE.

Anyway, the problem is that the project is failing to build because it can’t find CMAKE_ROOT, meaning that it can’t use cmake to build the project, I’ve looked into the .platformio folder to see if the cmake package was downloaded and it was.

I’m on Windows and cmake is located in the folder packages\tool-cmake\bin inside the .platformio folder, but the build configuration of the project is looking for cmake in the packages\tool-cmake\share\cmake-3.16 folder, which doesn’t exist.

This is the complete output of the build terminal:

Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: espidf)
----------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 (3.4.0) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-espidf 3.40301.0 (4.3.1)
 - tool-cmake 3.16.4
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - tool-idf 1.0.1
 - tool-mconf 1.4060000.20190628 (406.0.0)
 - tool-ninja 1.9.0
 - toolchain-esp32ulp 1.22851.191205 (2.28.51)
 - toolchain-riscv32-esp 8.4.0+2021r1
 - toolchain-xtensa-esp32 8.4.0+2021r1
 - toolchain-xtensa-esp32s2 8.4.0+2021r1
Warning! Starting with ESP-IDF v4.0, new project structure is required: 
https://docs.platformio.org/en/latest/frameworks/espidf.html#project-structure
Reading CMake configuration...

CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
C:/Users/MyUser/.platformio/packages/tool-cmake/share/cmake-3.16
CMake Error: Error executing cmake::LoadCache(). Aborting.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
valeroscommented, Nov 24, 2021

Strange, but I cannot reproduce the issue on my Windows machine., the project compiled just fine. Could you please delete the folder C:/Users/MyUser/.platformio/packages/tool-cmake and try to compile your project again?

0reactions
valeroscommented, Nov 25, 2021

I know this is a pretty simple fix to an unknown cause, but I think it would be great if it was added somewhere in the docs!

For some reason your previous installation for the CMake packages was corrupted (maybe installation process was interrupted, an antivirus didn’t like the package, etc.). Anyway, you are the first one who reported such a problem for the last several years. I believe we can consider this problem as a one-time incident.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not find CMAKE_ROOT - Usage - CMake Discourse
It sounds like you've moved the cmake executable out of its installation tree. It needs to be kept in the same directory structure...
Read more >
How to fix "CMake Error: Could not find CMAKE_ROOT"?
Are you sure that you are executing cmake by its final full path name and not symbolic link? Currently cmake won't work properly...
Read more >
CMake Error: Could not find CMAKE_ROOT? - Ask Ubuntu
This is the error I'm getting: CMake Error: Could not find CMAKE_ROOT !!! CMake has most likely not been installed correctly. Modules directory ......
Read more >
CMake Error: Could not find CMAKE_ROOT !!! (#22280) · Issues
I am building cmake on an Ubuntu 18 system. I follow the exact instructions in README, i.e. > ./bootstrap && make && sudo...
Read more >
[CMake] Cygwin cmake - Could not find CMAKE_ROOT
CMake Error: Could not find CMAKE_ROOT !!! CMake has most likely not been installed correctly. ... In each case I've installed cmake using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found