generate_random_id(CMAKE_RESOLVER_COMPILER_MSVC_ID)

set(FLAME_DEFINE_COMPILER_MSVC
	CMAKE_RESOLVER_COMPILER_MSVC=${CMAKE_RESOLVER_COMPILER_MSVC_ID})

if(("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
		OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"))
	message(STATUS "Detect CL.EXE")

	set(FLAME_DEFINE_EXPORT "CMAKE_RESOLVER_EXPORT=__declspec(dllexport)")

	set(CMAKE_RESOLVER_COMPILER_CURRENT_ID ${CMAKE_RESOLVER_COMPILER_MSVC_ID})

	set(FLAME_FLAG_BIG_OBJECT "/bigobj")

	if(CMAKE_CXX_COMPILER)
		set(FLAME_CXX_FLAG_NO_RTTI "/GR")
		set(FLAME_CXX_FLAG_RTTI "/GR-")

		set(FLAME_CXX_FLAG_NO_EXCEPTIONS "/EHsc-")
		set(FLAME_CXX_FLAG_EXCEPTIONS "/EHsc")
	endif()

	set(FLAME_WARNING_FLAG_LIST "/W4")
	set(FLAME_WARNING_AS_ERROR_FLAG "/WX")
endif()

function(flame_shared_set_export_symbols_msvc TARGET_NAME)
	target_compile_options(${TARGET_NAME} PRIVATE ${FLAME_FLAG_BIG_OBJECT})
	set_target_properties(${TARGET_NAME}
		PROPERTIES
			WINDOWS_EXPORT_ALL_SYMBOLS ON)
endfunction()
