Add MSVC-Syntax C++17 Compiler Argument for Windows #125
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.
While the ability to build
libfuzzer-sys
on Windows systems is already supported and does indeed work, there are certain build environments on Windows where the C++17 standard is not chosen by default. When this happens, errors like this may occur during build:The C++17 standard is selected in the current
build.rs
script, but because it's written in GCC-friendly syntax (-std=c++17
), MSVC ignores it and doesn't apply the preference (warning D9002):This PR adds code that checks for builds on a Windows system and instead uses the MSVC-friendly syntax (
/std:c++17
). When not on Windows, the original-std=c++17
is still used. (See this page for information on the MSVC/std
option.)Temporary Workaround for Devs
For anyone else facing this issue, a temporary workaround is to set the
CL
environment variable to specify the/std:c++17
argument; this will pass it to the compiler. (See here for more information)