Cmake: -B vs -build


I was following an (old) tutorial, which show these two commands to execute in order to build my plugin on JUCE:

cmake -B cmake-build
cmake --build cmake-build

What’s the differences between the two? And when I need to execute the first?
It seems most of the cases I just need the second one.


The first is the generate step - it generates all the targets specified in your CMakeLists.txt for the IDE that can be specified with the -G argument. E.g.

cmake -B cmake-build -G Xcode

to generate an Xcode project.

The second step is the actual build step that runs the C++ compiler.

1 Like

Clear! Thanks for the detailed infos.

To be more specific: -B defines a folder for the targets. If this folder doesn’t exist, it will be created.