# windows: fixes to support using zig cc/c\+\+ with CMake on Windows · gitcafe/zig

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

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

Visibility: public

Requested revision: b42442f5b4913938b04f580b1d13a1fd7318514d

Requested commit: b42442f5b4913938b04f580b1d13a1fd7318514d

Commit: b42442f5b4913938b04f580b1d13a1fd7318514d

Tree: db86066c6ea6dc6f34904c162a49bf450c6419bb

Author: kcbanner

Committer: kcbanner

## Message

```
windows: fixes to support using zig cc/c++ with CMake on Windows

Using zig cc with CMake on Windows was failing during compiler
detection. -nostdinc was causing the crt not to be linked, and Coff/lld.zig
assumed that wWinMainCRTStartup would be present in this case.

-nostdlib did not prevent the default behaviour of linking libc++ when
zig c++ was used. This caused libc++ to be built when CMake ran
ABI detection using zig c++, which fails as libcxxabi cannot compile
under MSVC.

- Change the behaviour of COFF -nostdinc to set /entry to the function that the
default CRT method for the specified subsystem would have called.
- Fix -ENTRY being passed twice if it was specified explicitly and -nostdlib was present.
- Add support for /pdb, /version, /implib, and /subsystem as linker args (passed by CMake)
- Remove -Ddisable-zstd, no longer needed
- Add -Ddisable-libcpp for use when bootstrapping on msvc

```

## Parents

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

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