0

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.

starball
  • 20,030
  • 7
  • 43
  • 238
Reinderien
  • 11,755
  • 5
  • 49
  • 77
  • @user This is running in vscode, which makes everything (including `PATH` modifications) more difficult. There is only one installation of Ninja, but yes, the directory containing the Ninja executable is not in `PATH` and I don't intend on putting it there, since this executable is supposed to be application-specific to the Espressif embedded toolchain – Reinderien May 06 '23 at 20:14

1 Answers1

1

If you don't want to modify the system PATH environment variable, and you're not invoking CMake via commandline (in which case I'd suggest you wrap your commands with cmake -D env to prepend to the PATH), and what you're trying isn't already working (you might want to try resetting the extensions state, which you can do with the CMake: Reset CMake Tools Extension State in the command palette), then you can try using ${env:...} VS Code variables in CMake tools' cmake.environment setting. Ex. "cmake.environment": { "PATH": "<path-to-your-ninja>${pathSeparator}${env:PATH}" }.

starball
  • 20,030
  • 7
  • 43
  • 238