This is not a distinction between Linux and Windows. This is a distinction between single-configuration and multi-configuration generators.
CMake uses different specification of "build type" when configure and build a project for different type of generators:
With a single-configuration generator (e.g. "Unix Makefiles") build type is specified on configuration stage using CMAKE_BUILD_TYPE
variable:
cmake -DCMAKE_BUILD_TYPE=Release <source-dir>
cmake --build .
With a multi-configuration generator (e.g. Visual Studio) build type is not known on configuration stage: this stage is performed for several build types at once. When build the project, one need to select appropriate build type, e.g. using --config
option:
cmake <source-dir>
cmake --build . --config Release
Because build type is specified on different stages, single set of commands rarely exists for both generator types.
However, single set of commands is perfectly possible in case of selecting generator "Unix Makefiles" on Linux and generator "NMake Makefiles" on Windows: both these generators are single-configuration.