After
cd build
cmake -B . -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake -S ..
Looks like
cmake --build .
and
make
do the same here on macOS.
So, when should I use one or the other?
CodePudding user response:
For a simple use there is not much difference, except that cmake --build
is more generic and work with any generator. So today you use make
, tomorrow ninja
or msbuild
and CMake handles it with simple cmake --build
which you can put in a script or readme.
But since the inception of presets these 2 methods started to really diverge. You can add some things in the build part of your preset which then can be invoked by cmake --build --preset MyPreset
while you can't do the same with simple make
.
So since you are using CMake as your project tool I'd recommend to start using its interface for the build since that's how it will be meant to use in the future anyway (at least it seems so).
CodePudding user response:
cmake -B
type - build type e.g .sln projects for vs studio
make - build your project
cmake - allows you to create a different build types for your project.