function(maximum_upgrade_cxx_version)
	if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20")
		set(CMAKE_CXX_STANDARD 23 PARENT_SCOPE)
	else()
		if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12")
			set(CMAKE_CXX_STANDARD 20 PARENT_SCOPE)
		else()
			if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.8")
				set(CMAKE_CXX_STANDARD 17 PARENT_SCOPE)
			else()
				set(CMAKE_CXX_STANDARD 14 PARENT_SCOPE)
			endif()
		endif()
	endif()
endfunction()

function(maximum_upgrade_cuda_version)
	if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20")
		set(CUDA_STANDARD 23 PARENT_SCOPE)
	else()
		if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12")
			set(CUDA_STANDARD 20 PARENT_SCOPE)
		else()
			set(CUDA_STANDARD 17 PARENT_SCOPE)
		endif()
	endif()
endfunction()

function(maximum_upgrade_objc_version)
	set(OBJC_STANDARD 11)
endfunction()

function(maximum_upgrade_objcxx_version)
	if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20")
		set(OBJCXX_STANDARD 23 PARENT_SCOPE)
	else()
		set(OBJCXX_STANDARD 20 PARENT_SCOPE)
	endif()
endfunction()

function(maximum_upgrade_c_version)
	if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.21")
		set(CMAKE_C_STANDARD 23 PARENT_SCOPE)
	else()
		set(CMAKE_C_STANDARD 11 PARENT_SCOPE)
	endif()
endfunction()

macro(maximum_upgrade_languages_versions)
	maximum_upgrade_c_version()
	maximum_upgrade_cxx_version()
	maximum_upgrade_cuda_version()
	maximum_upgrade_objc_version()
	maximum_upgrade_objcxx_version()
endmacro()
