This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

VS Code: Unable to determine what CMake generator to use.

When I create a new project from samples in VS Code I get this error
[variant] Loaded new set of variants
[kit] Successfully loaded 9 kits from C:\Users\Andrea\AppData\Local\CMakeTools\cmake-tools-kits.json
[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.
[main] Configuring folder: hello_world
[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.
How can I fix it?
  • Hi Andrea,

    You might not be using the proper cmake when you are trying to create a new project from sample. The cmake that you should be using is located inside the toolchain folder of your NCS installation directory. 
    If you go to the VS Code extensions, find nRF Connect for VS Code, right click and choose Extension Settings. There you should see Nrf-connect>Toolchain:Path. If you are using NCS 1.8, it should be $(workspaceFolder:v1.8.0). 
    In case abovementioned looks OK, and you still have a problem, I would suggest that you reinstall the Toolchain Manager.

    You can test which toolchain path you are using by making a new freestanding application. You should see the Toolchain path under nRF Connect Toolchain.

    Best regards,
    Dejan

  • I would suggest that you reinstall the Toolchain Manager.

    I've reinstalled it two times!

    If you go to the VS Code extensions, find nRF Connect for VS Code, right click and choose Extension Settings. There you should see Nrf-connect>Toolchain:Path. If you are using NCS 1.8, it should be $(workspaceFolder:v1.8.0). 

    After select the SDK and Toolchain in the Quick Setup on Welcome page

    in the Extension Settings I have

    and when I try to create new application I have

    . But when I press the "Create Application" button in the output pannel I get

    [variant] Loaded new set of variants
    [kit] Successfully loaded 9 kits from C:\Users\Andrea\AppData\Local\CMakeTools\cmake-tools-kits.json
    [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.
    [main] Configuring folder: hello_world 
    [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.
    [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 tried to install the Nordic environment on another clean notebook and it works! Maybe on my notebook I've some corruption between VS Code extensions (PlatformIO, Flutter, Espressiff...)?

  • Hi Andrea,

    Configuration pages that you showed here seem to be correct.

    When did you start getting this problem? Was it possible for you to make new application from sample before you started experiencing this error?

    Best regards,
    Dejan

  • When did you start getting this problem?

    From the start.

    Was it possible for you to make new application from sample before you started experiencing this error?

    No Disappointed

    At the begin I had the error

    [variant] Loaded new set of variants
    [kit] Successfully loaded 9 kits from C:\Users\Andrea\AppData\Local\CMakeTools\cmake-tools-kits.json
    [main] Configuring folder: blinky
    [proc] Executing command: C:\Users\Andrea\.espressif\tools\cmake\3.16.4\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Hc:/Users/Andrea/Documents/NordicApps/blinky -Bc:/Users/Andrea/Documents/NordicApps/blinky/build -G "Visual Studio 16 2019" -T host=x64 -A x64
    [cmake] Not searching for unused variables given on the command line.
    [cmake] CMake Error at CMakeLists.txt:3 (cmake_minimum_required):
    [cmake]   CMake 3.20.0 or higher is required.  You are running version 3.16.4
    [cmake]
    [cmake]
    [cmake] -- Configuring incomplete, errors occurred!

    As you can read the extension tried to use the cmake of espressiff toolchain, giving a version error. Now I unistalled the (no longer necessary) espressiff extension and deleted its tollchain paths in the PATH environment variable. And now I get the error above.

  • HI Andrea,

    What is xx in cmake-3.xx (for example, cmake-3.20) directory inside your ncs\1.8.0\toolchain\opt\share folder?

    What is the last version of the rst file which is visible in your ncs\1.8.0\toolchain\opt\share\cmake-3.xx\Help\release folder?  

    Please open your Toolchain Manager, press down arrow and choose "Open Command Prompt". Type "cmake --version" command and share the output of the command.

    Best regards,
    Dejan

Related