cmake build does not support Ninja builds

Bug #1668186 reported by Andrew McDermott
This bug report is a duplicate of:  Bug #1802314: use cmake primitives instead. Edit Remove
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
Triaged
Undecided
Unassigned

Bug Description

I wanted to explicitly target Ninja as my CMake build generator.

For example:

name: rtags
version: '0.1'
summary: rtags - a C/C++ source code indexer
description: |
  A C/C++ client/server indexer for c/c++/objc[++] with integration
  for Emacs based on clang.

parts:
  rtags:
    plugin: cmake
    source: https://github.com/Andersbakken/rtags.git
    configflags: [-GNinja]

But this always fails as snapcraft assumes CMake == "UNIX Makefiles" and always invokes 'make' irrespective of the specified CMake build generator.

Example output from `snapcraft build`:

-- Configuring done
-- Generating done
-- Build files have been written to: /home/aim/repos/github/frobware/rtags-snap/parts/rtags/build
make -j8
make: *** No targets specified and no makefile found. Stop.
Command '['/bin/sh', '/tmp/tmpsmpeb2_6', 'make', '-j8']' returned non-zero exit status 2

Whereas CMake correctly generated build.ninja

$ ls -l /home/aim/repos/github/frobware/rtags-snap/parts/rtags/build/build.ninja
-rw-rw-r-- 1 aim aim 118553 Feb 27 08:48 /home/aim/repos/github/frobware/rtags-snap/parts/rtags/build/build.ninja

Revision history for this message
Cris Dywan (kalikiana) wrote :

Two things need to happen to make this work: Snapcraft needs to read the generator specified with -G. In the case of ninja, it should install ninja-build (add it to self.build_packages). Bonus points for an error if an unsupported generator is being specified.

Maybe a dedicated options like "generator" is even clearer, where it would add -G accordingly, since it could use an enum with specific values.

Changed in snapcraft:
status: New → Confirmed
Changed in snapcraft:
status: Confirmed → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.