CI: quote the OpenSSL installer's /DIR argument

Start-Process joins ArgumentList entries with spaces, so /DIR=C:\Program
Files\OpenSSL reached Inno Setup as /DIR=C:\Program and the install landed
there. Linking still succeeded, because the import libraries were present
under that path, and the failure surfaced only when gtest_discover_tests ran
the test binary: exit code 0xc0000135, DLL not found, since PATH pointed at
C:\Program Files\OpenSSL\bin.

Quote the value, and assert that the import libraries and runtime DLLs are
where we expect before exporting PATH, so a misplaced install fails loudly at
the install step instead of quietly at load time.
This commit is contained in:
yhirose
2026-08-25 19:09:56 -04:00
parent f3e5a93a5b
commit af75a4160f

View File

@@ -552,12 +552,22 @@ jobs:
} }
# Same silent flags the Chocolatey package used. The installer is Inno # Same silent flags the Chocolatey package used. The installer is Inno
# Setup, so /DIR pins the location CMake already looks in. # Setup, so /DIR pins the location CMake already looks in. The inner
# quotes matter: ArgumentList joins on spaces, so an unquoted /DIR
# would install to C:\Program and only fail later, at load time.
$dir = 'C:\Program Files\OpenSSL' $dir = 'C:\Program Files\OpenSSL'
$proc = Start-Process $installer -Wait -PassThru -ArgumentList ` $proc = Start-Process $installer -Wait -PassThru -ArgumentList `
'/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/SP-', "/DIR=$dir" '/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/SP-', "/DIR=`"$dir`""
if ($proc.ExitCode -ne 0) { throw "Installer exited with $($proc.ExitCode)" } if ($proc.ExitCode -ne 0) { throw "Installer exited with $($proc.ExitCode)" }
# Catch a misplaced install here rather than at link or load time.
if (-not (Test-Path "$dir\lib\VC\x64\MD\libcrypto.lib")) {
throw "OpenSSL import libraries missing under $dir"
}
if (-not (Get-ChildItem "$dir\bin\libcrypto-*.dll" -ErrorAction SilentlyContinue)) {
throw "OpenSSL runtime DLLs missing under $dir\bin"
}
"$dir\bin" | Out-File $env:GITHUB_PATH -Append -Encoding utf8 "$dir\bin" | Out-File $env:GITHUB_PATH -Append -Encoding utf8
"OPENSSL_CONF=$dir\bin\openssl.cfg" | Out-File $env:GITHUB_ENV -Append -Encoding utf8 "OPENSSL_CONF=$dir\bin\openssl.cfg" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
- name: Configure CMake ${{ matrix.config.name }} - name: Configure CMake ${{ matrix.config.name }}