@@ -42,6 +42,34 @@ if ($missing.count -ge 1) {
4242
4343$project_root = (Get-Item - Path " .\" - Verbose).FullName -replace " \\" , " /"
4444$vcpkg_root = Install-Vcpkg " ${project_root} " " "
45+
46+ Write-Host - ForegroundColor Cyan " Patching crc32c portfile for CMake policy..."
47+ $crc32c_portfile = " ${vcpkg_root} /ports/crc32c/portfile.cmake"
48+ if (Test-Path $crc32c_portfile ) {
49+ # --- DEBUG LOGGING (BEFORE) ---
50+ Write-Host - ForegroundColor Yellow " ========= CONTENTS of $crc32c_portfile BEFORE patch ========="
51+ Get-Content $crc32c_portfile
52+ Write-Host - ForegroundColor Yellow " ============================================================"
53+ # --- END DEBUG LOGGING ---
54+
55+ $content = Get-Content - Raw - Path $crc32c_portfile
56+
57+ # Add our policy fix to the vcpkg_cmake_configure call
58+ # Use the .Replace() method for a literal string replacement, not regex
59+ $new_content = $content.Replace (" vcpkg_cmake_configure(" , " vcpkg_cmake_configure( OPTIONS -DCMAKE_POLICY_VERSION_MINIMUM=3.5 " )
60+
61+ # --- DEBUG LOGGING (AFTER) ---
62+ Write-Host - ForegroundColor Yellow " ========= CONTENTS of $crc32c_portfile AFTER patch ========="
63+ Write-Host $new_content
64+ Write-Host - ForegroundColor Yellow " ==========================================================="
65+ # --- END DEBUG LOGGING ---
66+
67+ Set-Content - Path $crc32c_portfile - Value $new_content
68+ Write-Host - ForegroundColor Cyan " Patch applied to $crc32c_portfile ."
69+ } else {
70+ Write-Host - ForegroundColor Red " Could not find crc32c portfile at $crc32c_portfile . Skipping patch (build will likely fail)."
71+ }
72+
4573$binary_dir = " cmake-out/${BuildName} "
4674# Install all dependencies from the vcpkg.json manifest file.
4775# This mirrors the behavior of our GHA builds.
@@ -90,7 +118,8 @@ $cmake_args=@(
90118 " -DCMAKE_CXX_COMPILER=cl.exe" ,
91119 " -DGOOGLE_CLOUD_CPP_ENABLE_WERROR=ON" ,
92120 " -DGOOGLE_CLOUD_CPP_ENABLE_CTYPE_CORD_WORKAROUND=ON" ,
93- " -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>"
121+ " -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>" ,
122+ " -DCMAKE_POLICY_VERSION_MINIMUM=3.5"
94123)
95124
96125# Configure CMake and create the build directory.
0 commit comments