'cmake --build vs make, what the difference?
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?
Solution 1:[1]
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).
Solution 2:[2]
cmake -B ...typehere
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ixSci |
| Solution 2 |
