cmake and build all in one step?


I’m trying to learn how to be “more modern” with CMake and move from doing, say:

mkdir build
cd build
cmake ..
make -j6 install

to the fancier “built-in” cmake way. So far I’ve gotten this down to:

cmake -S . -B build
cmake --build build --target install -j6

So my next question is: Is there any way to combine these? I guess I was hoping to get it to a single command if possible :slight_smile: That is make the build dir, run cmake and run make install for me in one fell swoop.

My guess is (since I can’t find anywhere on the internet about it) is “no”. Separation of concerns. But I thought I’d ask.

Indeed. Your example is about as good as you can get. Sorry :frowning:

Okay. Thanks. Next up: A presets question!