1 # - Check whether the CXX compiler supports a given flag.
2 # CHECK_CXX_COMPILER_FLAG(FLAG VARIABLE)
4 # FLAG - the compiler flag
5 # VARIABLE - variable to store the result
7 # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
9 # Redistribution and use is allowed according to the terms of the BSD license.
10 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
13 INCLUDE(CheckCXXSourceCompiles)
15 MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
16 SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
17 SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
18 CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT})
19 SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
20 ENDMACRO (CHECK_CXX_COMPILER_FLAG)