Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake command line arguments in a Ninja build

I am trying to use Ninja + CMake to build a project.

This project has a custom target that takes additional arguments.

E.g. make target option=value

It works fine in make, however I am not sure how to get Ninja to take in additional command line arguments. Is this possible with a Ninja build?

like image 255
Trent Avatar asked Sep 05 '25 10:09

Trent


1 Answers

I don't think it's possible to do directly through Ninja. I just scanned through the Ninja documentation to double check and didn't see anything.

Instead, you could modify CMake cache variables via CMake (see cmake -D and cmake -L). That way you could change your build on the fly, or create a few different build directories with different settings in each one.

like image 126
escrafford Avatar answered Sep 10 '25 01:09

escrafford