Restore cmake_policy in GenerateUninstaller, fix EVG batch scripts, and use Ninja with mingw-w64 #2070
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Followup to #2066. Identified the following error on closer inspection of the
install-uninstall-check-msvc
task output (despite task success):This is caused by the
CMAKE
env var being overridden in the batch script, which ends up using an older system-provided CMake version than expected. Theinstall-uninstall-*
tasks for MSVC and MinGW have apparently been silently broken for years (😱) since 3165a35 raised the minimum required CMake version from 3.1 to 3.15 in the 1.24.0 release on June 2023. Furthermore, 070b35ab broke theuninstall
batch script on Windows (but not in a way that impacts the uninstall operations themselves, as files and directories are still correctly removed), resulting in baffling error messages such as:These issues will be fixed by a followup PR that resolves CDRIVER-6062. For now, the non-zero exit code for the uninstall command is deliberately ignored.
These issues exposed a severe lack of error-handling checks in the batch scripts, for which there is unfortunately no Bash
set -o errexit
equivalent. This PR updates all batch scripts to consistently use the|| goto :error
pattern for all potentially-failing commands. Applying these changes revealed a whole host of silently-ignored issues which are now addressed by this PR:robocopy
which copies the source directory into the binary directory.PATH
manipulation to obtain mingw-w64 GCC which is now reliably provided via Chocolatey.vsvars64.bat
to load the Visual Studio developer environment.cmake_policy()
by CDRIVER-6059 set CMake max policy version to 4.0 #2066 inGenerateUninstaller.cmake
after realizing it may be evaluated in CMake script mode during the install step.OLD
to avoid even more noisy diagnostic output.And as drive-by improvements:
redirect_standard_error_to_output: true
to prevent confusing log output due to interleaving of stdout and stderr.msvc
andmingw
scripts so the giantecho.%CC%| findstr /I "gcc">Nul && ( ... ) || ( ... )
is not treated as a single big echoed batch command.CC
env var is also updated to correctly indicate the compiler to use (gcc
, notmingw
), since we are only really interested in testing compilation of our libraries with the mingw-w64 compiler on Windows, not the particulars of the build system of choice.Note
The
link-with-bson-mingw
andlink-with-cmake-mingw
tasks are left as effectively no-op tasks due to the lack ofpkg-config
availability on Windows distros.