root/trunk/cmake/CheckCCompilerFlag.cmake

Revision 43, 0.7 KB (checked in by anton, 3 years ago)

trunk replaced with 1.0RC1

Line 
1# - Check whether the C compiler supports a given flag.
2# CHECK_C_COMPILER_FLAG(FLAG VARIABLE)
3#
4#  FLAG - the compiler flag
5#  VARIABLE - variable to store the result
6
7# Copyright (c) 2006, Alexander Neundorf, <neundorf at kde.org>
8#
9# Redistribution and use is allowed according to the terms of the BSD license.
10# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
11
12
13INCLUDE(CheckCSourceCompiles)
14
15MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
16   SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
17   SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
18   CHECK_C_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT})
19   SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
20ENDMACRO (CHECK_C_COMPILER_FLAG)
Note: See TracBrowser for help on using the browser.