# Use correct compiler flags in MSVC bootstrap builds of Zig · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/9bb76f8ce0b36211e0ff1f502ec46aa5a0142cd0)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 9bb76f8ce0b36211e0ff1f502ec46aa5a0142cd0

Requested commit: 9bb76f8ce0b36211e0ff1f502ec46aa5a0142cd0

Commit: 9bb76f8ce0b36211e0ff1f502ec46aa5a0142cd0

Tree: e88f6204cda7fd9d9a9a1b0ae1a608999005f0f8

Author: Bodie Solomon

Committer: Andrew Kelley

## Message

```
Use correct compiler flags in MSVC bootstrap builds of Zig

https://github.com/ziglang/zig/issues/4877

The CMake build of Zig from C++ uses hand-set compiler flags which are
not compatible with the Microsoft C/C++ Optimizing Compiler (cl.exe)
used by Visual Studio.

This commit attempts to conform them to match the Clang/GCC options
under MSVC builds.

Note that CL does not have a concept of C99 or "-O3", and may imply
other optimizations in "/O2" than are implied by Clang/GCC "-O3".

Visual Studio 2019 documentation for cl.exe's optimization options:
https://docs.microsoft.com/en-us/cpp/build/reference/o-options-optimize-code?view=vs-2019

Visual Studio 2019 doc for cl.exe's C++ standard options:
https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=vs-2019

```

## Parents

- [d34a3c66b36e3afc8ea7f275b449033fa7a1b4bc](https://git.cafe/gitcafe/zig/commit/d34a3c66b36e3afc8ea7f275b449033fa7a1b4bc?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/9bb76f8ce0b36211e0ff1f502ec46aa5a0142cd0?format=markdown)
