# How to use all cross configs for custom targets ?

**URL:** https://discourse.cmake.org/t/how-to-use-all-cross-configs-for-custom-targets/7908
**Category:** Usage
**Created:** [April 14, 2023, 5:36pm UTC](https://discourse.cmake.org/t/how-to-use-all-cross-configs-for-custom-targets/7908 "2023-04-14T17:36:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![abdelmaged](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abdelmaged/32/3176_2.png) [@abdelmaged](https://discourse.cmake.org/u/abdelmaged)
#### Post date: [April 14, 2023, 5:36pm UTC](https://discourse.cmake.org/t/how-to-use-all-cross-configs-for-custom-targets/7908/1 "2023-04-14T17:36:50Z")

</div>

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 ?

---

<div class="post-metadata">

### Author: ![benthevining](https://discourse.cmake.org/user_avatar/discourse.cmake.org/benthevining/32/1924_2.png) [@benthevining](https://discourse.cmake.org/u/benthevining)
#### Post date: [April 14, 2023, 7:49pm UTC](https://discourse.cmake.org/t/how-to-use-all-cross-configs-for-custom-targets/7908/2 "2023-04-14T19:49:24Z")

</div>

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 `-` .

---

<div class="post-metadata">

### Author: ![abdelmaged](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abdelmaged/32/3176_2.png) [@abdelmaged](https://discourse.cmake.org/u/abdelmaged)
#### Post date: [April 14, 2023, 10:49pm UTC](https://discourse.cmake.org/t/how-to-use-all-cross-configs-for-custom-targets/7908/3 "2023-04-14T22:49:58Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![abdelmaged](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abdelmaged/32/3176_2.png) [@abdelmaged](https://discourse.cmake.org/u/abdelmaged)
#### Post date: [May 5, 2023, 12:17am UTC](https://discourse.cmake.org/t/how-to-use-all-cross-configs-for-custom-targets/7908/4 "2023-05-05T00:17:05Z")

</div>

CC: @ben.boeckel

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 5, 2023, 12:27pm UTC](https://discourse.cmake.org/t/how-to-use-all-cross-configs-for-custom-targets/7908/5 "2023-05-05T12:27:39Z")

</div>

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