Skip to content

cmake: Teach --build mode to support multiple targets

Fixes: #16136 (closed)
Topic-rename: cmake--build-multiple-targets

With this Merge Request I have added support for multiple targets for following generators:

  1. Xcode (verified on Xcode 10.1 and macOS Mohave 10.14.3)
  2. Unix Makefiles (verified on Xcode 10.1 and macOS Mohave 10.14.3)
  3. Ninja (verified on Xcode 10.1 and macOS Mohave 10.14.3)
  4. Green Hills MULTI (cmGlobalGhsMultiGenerator) - not verified. Implementation is based on documentation. The backward compatibility with one target was preserved.
  5. Visual Studio 9 - (verified on Windows 7 and Visual C++ Express 9).
  6. Visual Studio 10+ and later - (verified on Windows 7 and Visual Studio 10 2010).

The Generators were tested with following commands:

  • Build default targets:

    $ cmake.exe --build .

  • Build two targets under one --target argument:

    $ cmake.exe --build . --target TestLibrary TestExecutable

  • Build three targets under two --target arguments, separated by -j:

    $ cmake.exe --build . --target TestLibrary TestExecutable --clean-first

    $ cmake.exe --build . --target TestLibrary TestExecutable

    $ cmake.exe --build . --target TestLibrary TestExecutable -j 1 --target TestLibrary2

Edited by Bartosz

Merge request reports