# Avoid windows.h from including some usually unused libs like winsocks.h, since this might cause some redefinition errors.
add_definitions(-DWIN32_LEAN_AND_MEAN)
# Ensure that projects build with Unicode support.
add_definitions(-DUNICODE-D_UNICODE)
# /W3 - Level 3 warnings
# /MP - Multi-threaded compilation
# /Zi - Output debugging information
# /Zm - Specifies the precompiled header memory allocation limit
# /Zo - Enhanced debug info for optimized builds
# /permissive- - Enables stricter C++ standards conformance checks
# /EHsc - C++-only exception handling semantics
# /utf-8 - Set source and execution character sets to UTF-8
# /volatile:iso - Use strict standards-compliant volatile semantics.
# /Zc:externConstexpr - Allow extern constexpr variables to have external linkage, like the standard mandates
# /Zc:inline - Let codegen omit inline functions in object files
# /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null
# /GT - Supports fiber safety for data allocated using static thread-local storage
add_compile_options(
/MP
/Zm200
/Zo
/permissive-
/EHsc
/std:c++latest
/utf-8
/volatile:iso
/Zc:externConstexpr
/Zc:inline
/Zc:throwingNew
/GT
# External headers diagnostics
/experimental:external# Enables the external headers options. This option isn't required in Visual Studio 2019 version 16.10 and later
/external:anglebrackets# Treats all headers included by #include <header>, where the header file is enclosed in angle brackets (< >), as external headers
/external:W0# Sets the default warning level to 0 for external headers, effectively turning off warnings for external headers
# Warnings
/W3
/WX
/we4062# Enumerator 'identifier' in a switch of enum 'enumeration' is not handled
/we4189# 'identifier': local variable is initialized but not referenced
/we4265# 'class': class has virtual functions, but destructor is not virtual
/we4388# 'expression': signed/unsigned mismatch
/we4389# 'operator': signed/unsigned mismatch
/we4456# Declaration of 'identifier' hides previous local declaration
/we4457# Declaration of 'identifier' hides function parameter
/we4458# Declaration of 'identifier' hides class member
/we4459# Declaration of 'identifier' hides global declaration
/we4505# 'function': unreferenced local function has been removed
/we4547# 'operator': operator before comma has no effect; expected operator with side-effect
/we4549# 'operator1': operator before comma has no effect; did you intend 'operator2'?
/we4555# Expression has no effect; expected expression with side-effect
/we4826# Conversion from 'type1' to 'type2' is sign-extended. This may cause unexpected runtime behavior.
/we5038# data member 'member1' will be initialized after data member 'member2'
/we5233# explicit lambda capture 'identifier' is not used
/we5245# 'function': unreferenced function with internal linkage has been removed