include_guard(GLOBAL)

set(CMAKE_C_STANDARD 11 CACHE STRING "")
set(CMAKE_C_STANDARD_REQUIRED ON CACHE STRING "")
set(CMAKE_C_EXTENSIONS OFF CACHE STRING "")

set(CMAKE_CXX_STANDARD 20 CACHE STRING "")
set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE STRING "")
set(CMAKE_CXX_EXTENSIONS OFF CACHE STRING "")

set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE STRING "")

set(MSVC_CPP_FLAGS "/Zc:strictStrings- /Zc:char8_t /utf-8 /wd26812 /wd28251")
set(MSVC_CXX_FLAGS "/EHsc /d2FH4 /GR /await")

set(CMAKE_C_FLAGS "/nologo ${MSVC_CPP_FLAGS}" CACHE STRING "")
set(CMAKE_CXX_FLAGS "/nologo ${MSVC_CPP_FLAGS} ${MSVC_CXX_FLAGS}" CACHE STRING "")

set(CMAKE_C_FLAGS_DEBUG "/O1 /Oi /GS- /Z7 /MT /DNDEBUG" CACHE STRING "")
set(CMAKE_CXX_FLAGS_DEBUG "/O1 /Oi /GS- /Z7 /MT /DNDEBUG" CACHE STRING "")
set(CMAKE_C_FLAGS_RELEASE "/O1 /Oi /GS- /GF /GL /Z7 /MT /DNDEBUG" CACHE STRING "")
set(CMAKE_CXX_FLAGS_RELEASE "/O1 /Oi /GS- /GF /GL /Z7 /MT /DNDEBUG" CACHE STRING "")

set(CMAKE_C_FLAGS_INIT "" CACHE STRING "")
set(CMAKE_CXX_FLAGS_INIT "" CACHE STRING "")

set(CMAKE_C_FLAGS_DEBUG_INIT "" CACHE STRING "")
set(CMAKE_CXX_FLAGS_DEBUG_INIT "" CACHE STRING "")

set(CMAKE_C_FLAGS_RELEASE_INIT "" CACHE STRING "")
set(CMAKE_CXX_FLAGS_RELEASE_INIT "" CACHE STRING "")

set(CMAKE_STATIC_LINKER_FLAGS "/nologo" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS "/nologo /DEBUG:NONE" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS "/nologo /DEBUG:NONE" CACHE STRING "")

set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/OPT:REF /OPT:ICF" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/OPT:REF /OPT:ICF" CACHE STRING "")

set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/OPT:REF /OPT:ICF /LTCG:INCREMENTAL" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/OPT:REF /OPT:ICF /LTCG:INCREMENTAL" CACHE STRING "")

set(CMAKE_ASM_MASM_FLAGS "/nologo" CACHE STRING "")

add_definitions(/D_WIN64 /D_WINDOWS /D_WIN32_WINNT=0x0A00 /DWINVER=0x0A00)
add_definitions(/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE)
add_definitions(/D_ATL_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_WARNINGS)

set(SILENCE_VS_WARNINGS "${CMAKE_C_COMPILER};${CMAKE_CXX_COMPILER}")
