Matter build: chip_codegen.cmake failing on windows because Python executable is not set

In NCS 3.1.x it is now necessary to generate code using the .matter file during the build process. However this is failing on Windows because there is a typo in the chip_codegen.cmake file on line 41:

    execute_process(
            COMMAND "${CHIP_ROOT}/scripts/codegen_paths.py" "--idl" "${ARG_INPUT}" ${ARG_OUTPUTS}
            OUTPUT_VARIABLE GENERATED_PATHS_OUT
    )


This should be:

    execute_process(
            COMMAND ${Python3_EXECUTABLE} "${CHIP_ROOT}/scripts/codegen_paths.py" "--idl" "${ARG_INPUT}" ${ARG_OUTPUTS}
            OUTPUT_VARIABLE GENERATED_PATHS_OUT
    )

Related