@echo off setlocal set SCRIPT_DIR=%~dp0 set BUILD_DIR=%SCRIPT_DIR%build if "%1"=="--clean" ( if exist "%BUILD_DIR%" ( echo Cleaning build directory... rmdir /s /q "%BUILD_DIR%" ) ) if not exist "%BUILD_DIR%\CMakeCache.txt" ( echo Configuring (first run will fetch Google Test)... cmake -S "%SCRIPT_DIR%" -B "%BUILD_DIR%" -DCMAKE_BUILD_TYPE=Debug if errorlevel 1 ( echo FAIL: cmake configure failed exit /b 1 ) ) echo Building tests... cmake --build "%BUILD_DIR%" --parallel if errorlevel 1 ( echo FAIL: build failed exit /b 1 ) echo. echo Running tests... echo. ctest --test-dir "%BUILD_DIR%" --output-on-failure if errorlevel 1 ( echo. echo FAIL: Some tests failed. exit /b 1 ) echo. echo PASS: All tests passed.