1 # - Check whether the C compiler supports a given flag.
2 # CHECK_C_COMPILER_FLAG(FLAG VARIABLE)
4 # FLAG - the compiler flag
5 # VARIABLE - variable to store the result
7 # This actually calls the check_c_source_compiles macro.
8 # See help for CheckCSourceCompiles for a listing of variables
9 # that can modify the build.
11 # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
13 # Redistribution and use is allowed according to the terms of the BSD license.
14 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
17 INCLUDE(CheckCSourceCompiles)
19 MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
20 SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
21 SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
22 CHECK_C_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT})
23 SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
24 ENDMACRO (CHECK_C_COMPILER_FLAG)