Campbell Barton 8d5334
include(CheckCCompilerFlag)
Campbell Barton 8d5334
include(CheckCXXCompilerFlag)
Campbell Barton 8d5334
Campbell Barton 8d5334
function(ADD_CHECK_C_COMPILER_FLAG
Campbell Barton 8d5334
	_CFLAGS
Campbell Barton 8d5334
	_CACHE_VAR
Campbell Barton 8d5334
	_FLAG
Campbell Barton 8d5334
	)
Campbell Barton 8d5334
Campbell Barton 8d5334
	CHECK_C_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
Campbell Barton 8d5334
	if(${_CACHE_VAR})
Campbell Barton 8d5334
		# message(STATUS "Using CFLAG: ${_FLAG}")
Campbell Barton 8d5334
		set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}" PARENT_SCOPE)
Campbell Barton 8d5334
	else()
Campbell Barton 8d5334
		message(STATUS "Unsupported CFLAG: ${_FLAG}")
Campbell Barton 8d5334
	endif()
Campbell Barton 8d5334
endfunction()
Campbell Barton 8d5334
Campbell Barton 8d5334
function(ADD_CHECK_CXX_COMPILER_FLAG
Campbell Barton 8d5334
	_CXXFLAGS
Campbell Barton 8d5334
	_CACHE_VAR
Campbell Barton 8d5334
	_FLAG
Campbell Barton 8d5334
	)
Campbell Barton 8d5334
Campbell Barton 8d5334
	CHECK_CXX_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
Campbell Barton 8d5334
	if(${_CACHE_VAR})
Campbell Barton 8d5334
		# message(STATUS "Using CXXFLAG: ${_FLAG}")
Campbell Barton 8d5334
		set(${_CXXFLAGS} "${${_CXXFLAGS}} ${_FLAG}" PARENT_SCOPE)
Campbell Barton 8d5334
	else()
Campbell Barton 8d5334
		message(STATUS "Unsupported CXXFLAG: ${_FLAG}")
Campbell Barton 8d5334
	endif()
Campbell Barton 8d5334
endfunction()
Campbell Barton 8d5334