#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# this file is under MIT License.
# See https://opensource.org/licenses/MIT for license information.
# Copyright (c) 2020-2022 moe-org All rights reserved.
#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# 负责做一些检查

# 必须设置CMAKE_BUILD_TYPE变量
if(NOT DEFINED CMAKE_BUILD_TYPE OR "${CMAKE_BUILD_TYPE}" STREQUAL "")
	message(FATAL_ERROR "not set up the CMAKE_BUILD_TYPE variable")
else()
	message(STATUS "build type:${CMAKE_BUILD_TYPE}")
endif()


# 标准编译套件:
# 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(STATUS "gcc version may be too old")
		message(WARNING "current version of compiler is not officially supported")
	endif()

elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
	if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13.0.0")
		message(STATUS "clang version may be too old")
		message(WARNING "current version of compiler is not officially supported")
	endif()

elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
	if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.30.0")
		message(STATUS "msvc version may be too old")
		message(WARNING "current version of compiler is not officially supported")
	endif()

else()
	message(
		WARNING 
		"current compiler is not officially supported:${CMAKE_CXX_COMPILER_ID}"
	)
endif()

