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