Unable to use 'west build -d ${targetDir} -- --preset ${presetName}' on nRF SDK v3.2.1

Environment

  • nRF Connect SDK: v3.2.1
  • Zephyr: 4.2.99 (NCS fork)
  • CMake (bundled): 3.21.0
  • Board: nrf5340dk_nrf5340_cpuapp
  • OS: Linux

Problem

Since upgrading from NCS v2.6.4 to v3.2.1, building 'west build' with a CMake preset no longer works:

CMake Error: Could not read presets from /home/user/ncs/v3.2.1/zephyr/share/sysbuild: File not found

This worked fine in NCS v2.6.4.

Root cause

In NCS v3.x, sysbuild is enabled by default. When sysbuild is active, west invokes CMake with -S <ncs>/zephyr/share/sysbuild instead of -S <project_root>. CMake 3.21 resolves --preset relative to the -S directory, so it looks for CMakePresets.json inside the NCS sysbuild directory — not in the project root where it actually lives — and fails with "File not found".

In NCS v2.6.4, sysbuild was not the default, so CMake was pointed at the project root and presets resolved correctly.

The Nordic documentation at https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/build_config.html#from-the-panel-view still shows:

west build -d ${targetDir} -- --preset ${presetName}

…but this does not work with NCS v3.x from the CLI.

Workaround

Expand the preset manually into explicit -D flag.

Alternatively, using --no-sysbuild does not help because sysbuild is required for the mcuboot + hci_ipc multi-image build.

Questions

  1. Is there an official supported way to use CMakePresets.json from the CLI with NCS v3.x + sysbuild enabled?
  2. Is the documentation going to be updated to reflect this change?

Related issues

Here some related issues but without a solution that helped me:

AI Answer

AI suggests to just follow: https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/build/sysbuild/index.html#sysbuild_and_cmake_presets, but note:

Using CMake presets with sysbuild requires CMake version 3.27 or higher.

But the CMake version bundled in nRF SDK 3.2.1 is the v3.21

Thanks

Parents
  • Hi,

    • Is there an official supported way to use CMakePresets.json from the CLI with NCS v3.x + sysbuild enabled?
    • Is the documentation going to be updated to reflect this change?

    I am not sure about the answers here, let me ask internally. I'll get back to you as soon as I have an answer. (you can expect feedback in the first half of next week)

    AI Answer

    AI suggests to just follow: https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/build/sysbuild/index.html#sysbuild_and_cmake_presets, but note:

    Using CMake presets with sysbuild requires CMake version 3.27 or higher.

    But the CMake version bundled in nRF SDK 3.2.1 is the v3.21

    Yes, this is correct for the latest SDK versions. If you go back the nRF SDK 3.2.1 documentation, this section is not present. (link)

    Best regards,

    Simon D-M

  • Hi,

    I've been told that Presets are a CMake feature and are generally expected to work out of the box. But when using sysbuild together with CMake presets, then CMake version >= 3.27 is indeed required. As far as I understood there are no proper alternatives of just using a more recent CMake version for sysbuild builds.

    So we don't really have an official answer for your issue... I've been told that you can try to use the v3.3.0 toolchain on your v3.2.1 project as this toolchain has the needed CMake version. Usually it is not a good idea to mix different toolchain and SDK version together but as these versions are kind of close together, it might work.

    Please tell me it that actually works or not.

    Best regards,

    Simon D-M

Reply
  • Hi,

    I've been told that Presets are a CMake feature and are generally expected to work out of the box. But when using sysbuild together with CMake presets, then CMake version >= 3.27 is indeed required. As far as I understood there are no proper alternatives of just using a more recent CMake version for sysbuild builds.

    So we don't really have an official answer for your issue... I've been told that you can try to use the v3.3.0 toolchain on your v3.2.1 project as this toolchain has the needed CMake version. Usually it is not a good idea to mix different toolchain and SDK version together but as these versions are kind of close together, it might work.

    Please tell me it that actually works or not.

    Best regards,

    Simon D-M

Children
No Data
Related