cmake build does not support Ninja builds
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:/
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/
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/
-rw-rw-r-- 1 aim aim 118553 Feb 27 08:48 /home/aim/
Changed in snapcraft: | |
status: | Confirmed → Triaged |
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.