Issue
As you can see I've tried a few approaches and none work:
CMakeSettings.json
{
"configurations": [
{
"name": "riscv32",
"generator": "Ninja"
}
]
}
cmake-kits.json
[
{
"name": "riscv32-esp-elf-gcc",
"isTrusted": true,
"compilers": {
"C": "/ProgramData/esp-idf-tools/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe",
"CXX": "/ProgramData/esp-idf-tools/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-g++.exe"
},
"toolchainFile": "/ProgramData/esp-idf/tools/cmake/toolchain-esp32c3.cmake",
"preferredGenerator": {
"name": "Ninja"
}
}
]
settings.json
{
"cmake.cmakePath": "/ProgramData/esp-idf-tools/tools/cmake/3.24.0/bin/cmake.exe",
"cmake.configureArgs": [
"-DCMAKE_MAKE_PROGRAM=/ProgramData/esp-idf-tools/tools/ninja/1.10.2/ninja.exe"
],
"cmake.buildArgs": [
"-DCMAKE_MAKE_PROGRAM=/ProgramData/esp-idf-tools/tools/ninja/1.10.2/ninja.exe"
],
"cmake.additionalCompilerSearchDirs": [
"/ProgramData/esp-idf-tools/tools/ninja/1.10.2"
]
}
On load I always get
[proc] The command: ninja --version failed with error: Error: spawn ninja ENOENT
[proc] The command: ninja-build --version failed with error: Error: spawn ninja-build ENOENT
[main] Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json, your Kit configuration or PATH variable. Error: No usable generator found.
I want to avoid adding (yet another) entry to the operating system's PATH
.
Solution
This was deeply frustrating, but I did eventually stumble into a solution.
Nothing in settings.json
helps. The only setting that takes any effect is in cmake-kits.json
:
[
{
"name": "riscv32-esp-elf-gcc",
"isTrusted": true,
"compilers": {
"C": "/ProgramData/esp-idf-tools/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe",
"CXX": "/ProgramData/esp-idf-tools/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-g++.exe"
},
"toolchainFile": "/ProgramData/esp-idf/tools/cmake/toolchain-esp32c3.cmake",
"preferredGenerator": {
"name": "Ninja"
},
"environmentVariables": {
"PATH": "/ProgramData/esp-idf-tools/tools/ninja/1.10.2;${env:PATH}"
}
}
]
Answered By - Reinderien Answer Checked By - Pedro (WPSolving Volunteer)