@echo off rem Wrapper around cmake.exe that injects policy/cache variables to force rem the release dynamic CRT (/MD) for Debug configurations. audiopus_sys rem calls cmake::build(opus_path), which invokes CMake configure; the rem upstream Opus CMakeLists.txt does not set CMP0091 or rem CMAKE_MSVC_RUNTIME_LIBRARY, so CMake defaults to /MDd in Debug rem builds. That pulls in __imp__CrtDbgReportW which is unresolved at rem test link time because the rest of the Rust/Cargo graph uses /MD. rem rem This wrapper is only invoked on Windows MSVC targets (see rem .cargo/config.toml [env] CMAKE_ entries). Non-Windows rem hosts are unaffected. rem rem cmake-rs invokes this as: cmake-msvc-release-crt.cmd rem and also: cmake-msvc-release-crt.cmd --build ... rem and also: cmake-msvc-release-crt.cmd --version rem and also: cmake-msvc-release-crt.cmd -E ... rem rem Echoes a marker to stdout so the cargo build log proves the wrapper rem was actually invoked. cmake-rs forwards cmake stdout to the build rem script log, so this surfaces in `cargo build -vv` output. setlocal echo cmake-msvc-release-crt.cmd: invoked with %* rem Pass through non-configure invocations unchanged. if "%~1"=="--build" goto :passthrough if "%~1"=="--version" goto :passthrough if "%~1"=="-E" goto :passthrough if "%~1"=="--install" goto :passthrough if "%~1"=="--open" goto :passthrough rem Configure invocation: inject -D flags before user args. echo cmake-msvc-release-crt.cmd: injecting CMP0091=NEW and CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL cmake.exe -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL %* exit /b %ERRORLEVEL% :passthrough cmake.exe %* exit /b %ERRORLEVEL%