#=================================================================
# file:         checker.cmake
# Copyright (c) 2020-2021 moe-org 保留所有权利
#=================================================================
# 检查编译器和编译环境

# 标准编译套件:
# msvc >= 19.30.0
# gcc >= 11.0.0
# clang >= 13.0.0

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
	if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.0.0")
		message(WARNING "gcc version may be too old")
		message(STATUS "official-build use gcc 11 or higher")
	endif()

elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
	if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13.0.0")
		message(WARNING "clang version may be too old")
		message(STATUS "official-build use clang 13 or higher")
	endif()

elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
	if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.30.0")
		message(WARNING "msvc version may be too old")
		message(STATUS "official-build use msvc 19.30 or higher")
	endif()

else()
	message(
		WARNING 
		"unknow c++ compiler:${CMAKE_CXX_COMPILER_ID}. something may go wrong"
	)
endif()
