How to call ninja-build instead of ninja?

I am using Visual Studio 2017 to remotely build software on a Centos 7 machine, using CMake.

On the Centos machine we installed the ninja-build package. So the ninja command is ‘ninja-build’.

How do I tell CMake to call ‘ninja-build’ instead of ‘ninja’?

Use the CMAKE_MAKE_PROGRAM variable:

$ cmake .. -G Ninja -DCMAKE_MAKE_PROGRAM=/path/to/ninja-build

Thank you

CMake should automatically find ninja-build by default if it is in the PATH.

With MR 4091 CMake 3.17’s Ninja generator will select either ninja or ninja-build whichever appears first in PATH. CMake 3.16 and below use ninja-build if it is anywhere in PATH and otherwise tries plain ninja.

@brad.king Thanks, I’m using CMake 3.16.1 and it has indeed found ninja-build on the path. Works ok.