# How to organise building across multiple compilers

**URL:** <https://forum.buildkite.community/t/how-to-organise-building-across-multiple-compilers/227>\
**Category:** General\
**Created:** [January 11, 2019, 10:35am UTC](https://forum.buildkite.community/t/how-to-organise-building-across-multiple-compilers/227 "2019-01-11T10:35:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeterBygrave](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@PeterBygrave](https://forum.buildkite.community/u/PeterBygrave)\
**Post date:** [January 11, 2019, 10:35am UTC](https://forum.buildkite.community/t/how-to-organise-building-across-multiple-compilers/227/1 "2019-01-11T10:35:23Z")

</div>

Hi,

I need to build and test my C++ project using multiple compilers. I currently just have a single step that does cmake, make, ctest and a single agent connected in to process it. I then have two pipelines, one builds in Debug mode and the other in Release.

I am unsure of what the best practice is for BuildKite? Should I have a single step with lots of different agents connected in with their own compilers set up? Should I make many steps that are all the same but have agent queue tags for requiring different compilers?

Many thanks in advance

Peter

---

<div class="post-metadata">

**Author:** ![anon85971592](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@anon85971592](https://forum.buildkite.community/u/anon85971592)\
**Post date:** [April 3, 2019, 9:23am UTC](https://forum.buildkite.community/t/how-to-organise-building-across-multiple-compilers/227/2 "2019-04-03T09:23:19Z")

</div>

👋 Hey @PeterBygrave - sorry for the late reply to this one!

> [@PeterBygrave](#):
>
> Should I make many steps that are all the same but have agent queue tags for requiring different compilers?

Yeah - that’s how I would go. You could also use [YAML anchors](https://medium.com/@kinghuang/docker-compose-anchors-aliases-extensions-a1e4105d70bd) to make it a little easier.

Here’s an example that you could work from:

```yaml
shared_build_step: &function
  command: "cmake && make && ctest"

steps:
  - <<: *shared_build_step
    agents:
      compiler: "compiler-1"

  - <<: *shared_build_step
    agents:
      compiler: "compiler-2"

  - <<: *shared_build_step
    agents:
      compiler: "compiler-3"

```

Another way is to have all the compilers installed on all the agents, and then in change a `COMPILER` environment variable - then dynamically choose the right compiler in your build scripts.

I hope that helps! And sorry again for the late reply!
