How to properly set cmake-ninja -j option in manifest

I have searched and cannot find what should be a simple thing. I need to know the proper syntax to pass what would be -j=3 on the command line to cmake-ninja. The simple reason is ninja by default uses something like 1 less than total virtual CPUs or perhaps physical. When building small things not a problem. When building the nearly 4K modules of CopperSpice the heavy use of templates means each “cpu” tends to need 8GB of RAM. I only have 24GB so I have to trim to 3. Yes, the machine runs out of virtual memory and locks up if I let it run flat out. Been there, done that, got the hat, T-shirt, drink holder, and bumper sticker.

It seems there should be a build-option one could add here, but I cannot find any documentation.

  "modules": [
    {
        "name": "copperspice",
        "buildsystem": "cmake-ninja",
        "builddir": true,
        "build-options" : { 
            "cxxflags": "-Wno-error"
        },
        "no-parallel-make": false,
        "config-opts": [
            "-DCMAKE_BUILD_TYPE=Release",
            "-Wno-dev"
        ],
        "sources": [
            {
                "type": "git",
                "url": "https://github.com/copperspice/copperspice.git"
            }
        ]
    }


        ]

What shouldn’t work, but appears to is this in the command file to launch the build.

#  --force-clean
flatpak-builder --user --jobs=3 --install  "$BUILD_DIR" "$SCRIPT_DIR/org.flatpak.RedDiamond.json"

I have searched and cannot find the doc. Can someone point me to the official documentation for cmake-ninja build options?

you can add no-parallel-make: true to the module do disable parallel build.

@hub

Thanks. I had that initially and waited for an eternity. Putting --jobs=3 on the flatpak-builder command line achieved using 3 CPU. I’m just not certain it is the “approved” way. I tried using NINJAFLAGS like I saw in some other things but that was not liked at all.

the thing is for flathub there is no way to specify --jobs so…

There is for flatpak-builder.

You can specify cmake options via

    "config-opts": [
        "-DCMAKE_BUILD_TYPE=Release",
        "-Wno-dev"
    ],

so there should be a something like

"ninja-opts": [ 
],

for switches and things to be passed straight through to ninja.

maybe you do it via config-opts and I was just too stupid to find any documentation showing me the correct way?