mkdir build_dir cd build_dir :: Configure step. cmake -G "NMake Makefiles" ^ -D CMAKE_BUILD_TYPE=Release ^ -D CMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ -D BUILD_SHARED_LIBS:BOOL=ON ^ -D CMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% ^ %SRC_DIR% if errorlevel 1 exit 1 :: Build. cmake --build . --config Release if errorlevel 1 exit 1 :: Test. ctest -C Release if errorlevel 1 exit 1 :: Install. cmake --build . --config Release --target install if errorlevel 1 exit 1