Snapcraft 3 snap package: cmake plugin invokes make when ninja is specified

Going by the patch in https://github.com/snapcore/snapcraft/pull/2397, snapcraft 3.1 or later should use cmake --build to build projects rather than hardcoding make. This ought to mean that if e.g. I use the -GNinja flag, the ninja backend will be used.

However, when trying to build a cmake-based project using the snapcraft snap package (either 3.1 or 3.1.1), snapcraft always winds up invoking make directly.

Here’s the part in question:

parts:
  ldc:
    source: https://github.com/ldc-developers/ldc.git
    source-tag: v1.10.0
    source-type: git
    plugin: cmake
    configflags:
    - -GNinja
    stage:
    - -etc/ldc2.conf
    build-packages:
    - gcc-multilib
    - g++-multilib
    - ldc
    - libedit-dev
    - llvm-dev
    - ninja-build
    - zlib1g-dev

However, when I build with snapcraft 3.1 or 3.1.1 (the snap packages of these versions), the cmake call goes:

cmake /home/joseph/code/snap/ldc2.snap/parts/ldc/src -DCMAKE_INSTALL_PREFIX= -GNinja
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found host D compiler /usr/bin/ldmd2, with default flags ''
-- Host D compiler ID: LDMD
-- Host D compiler version: LDC - the LLVM D compiler (0.17.1)
-- Host D compiler front-end version: 2068
-- Found LLVM: /usr/lib/llvm-3.8 (found suitable version "3.8.0", minimum required is "3.7") 
-- LDC version identifier: 1.10.0
-- Building LDC with dynamic compilation support: False (LDC_DYNAMIC_COMPILE=False)
-- Building LDC with integrated LLD: OFF (LDC_WITH_LLD=OFF)
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for setupterm in tinfo
-- Looking for setupterm in tinfo - found
-- Performing Test LINKER_ACCEPTS_EXPORT_DYNAMIC_FLAG
-- Performing Test LINKER_ACCEPTS_EXPORT_DYNAMIC_FLAG - Success
-- Building LDC with plugin support: ON (LDC_ENABLE_PLUGINS=ON)
-- Host D compiler linker program: /usr/bin/cc
-- Host D compiler linker flags: -L/usr/lib;-lphobos2-ldc;-ldruntime-ldc;-lrt;-Wl,--gc-sections;-ldl;-lpthread;-lm;-m64
-- Looking for _SC_ARG_MAX
-- Looking for _SC_ARG_MAX - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Using path for Intrinsics.td: /usr/lib/llvm-3.8/include
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Looking for unistd.h
-- Looking for unistd.h - found
-- GDB 7.11.1 detected
-- LDC_HOST_ARCH: 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/joseph/code/snap/ldc2.snap/parts/ldc/build
make -j4
make: *** No targets specified and no makefile found. Stop.
Failed to run 'make -j4' for 'ldc': Exited with code 2.
Verify that the part is using the correct parameters and try again.

If I manually cd through into parts/ldc/build and type cmake --build . then it will correctly start building using ninja. So I can only conclude that this is a bug in the snapcraft snap packages themselves, with the cmake plugin not working as expected.

@sergiusens do you have any thoughts on this, as the author of the patch that supposedly addressed this? I’ve tried with both the 3.1 snapcraft package in the stable channel, and 3.1.1 in candidate, with the same results each time.