How to use all cross configs for custom targets ?

I’m trying to use Ninja Multi-Config, and setting CMAKE_CROSS_CONFIGS to all, so that I can build all configuration at once with command line “cmake --build build -t world:all”
Where world is a custom targets, and just an alias for some other executables and shared libraries.
However, when passing world:all, it says unknown target.

Is there a way to build custom targets for all configs ?

When calling cmke --build, you have to use the target names known to CMake. world:all is indeed not a known target to cmake, that syntax is only understood by ninja itself. To specify a configuration, you would do something like cmake --build build --target world --config all. I’d recommend calling ninja directly or passing ninja-specific arguments to cmake --build after a - .

If the target is executable or library, cmake understands the syntax as well i.e.: cmake --build build --target myexe:all will build all configurations (Debug, Release, …), but if the target is custom, it seems that it does not exists.

1 Like

CC: @ben.boeckel

I’m not all that familiar with this part of NMC. @kyle.edwards?