include_guard(GLOBAL)
#set(base_dir "C:/Program Files/Microsoft Visual Studio/18/Enterprise/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x64")
#set(CMAKE_C_COMPILER "${base_dir}/cl.bat" CACHE FILEPATH "")
#set(CMAKE_CXX_COMPILER "{${base_dir}}/cl.bat" CACHE FILEPATH "")
#set(CMAKE_MAKE_PROGRAM "C:/Program Files/Microsoft Visual Studio/18/Enterprise/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" CACHE FILEPATH "")
function(_append_msvc_init_options variable)
    set(value "${${variable}}")
    separate_arguments(existing_options WINDOWS_COMMAND "${value}")
    foreach (option IN LISTS ARGN)
        list(FIND existing_options "${option}" option_index)
        if (option_index EQUAL -1)
            list(APPEND existing_options "${option}")
        endif ()
    endforeach ()
    list(JOIN existing_options " " value)
    set(${variable} "${value}" PARENT_SCOPE)
endfunction()
_append_msvc_init_options(
        CMAKE_CXX_FLAGS_INIT
        /wd4819
        /utf-8
        /Zc:preprocessor
        /DNOMINMAX
        /D_USE_MATH_DEFINES
        /EHsc
        /bigobj
        /DWIN32_LEAN_AND_MEAN
)
_append_msvc_init_options(
        CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT
        /PROFILE
)
_append_msvc_init_options(
        CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT
        /PROFILE
)
_append_msvc_init_options(
        CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT
        /PROFILE
)
