]> git.uio.no Git - u/mrichter/AliRoot.git/blob - Vc/cmake/CheckCCompilerFlag.cmake
bug fix for pion PID in systematics
[u/mrichter/AliRoot.git] / Vc / cmake / CheckCCompilerFlag.cmake
1 # - Check whether the C compiler supports a given flag.
2 # CHECK_C_COMPILER_FLAG(<flag> <var>)
3 #  <flag> - the compiler flag
4 #  <var>  - variable to store the result
5 # This internally calls the check_c_source_compiles macro.
6 # See help for CheckCSourceCompiles for a listing of variables
7 # that can modify the build.
8
9 #=============================================================================
10 # Copyright 2006-2009 Kitware, Inc.
11 # Copyright 2006 Alexander Neundorf <neundorf@kde.org>
12 # Copyright 2011 Matthias Kretz <kretz@kde.org>
13 #
14 # Distributed under the OSI-approved BSD License (the "License");
15 # see accompanying file Copyright.txt for details.
16 #
17 # This software is distributed WITHOUT ANY WARRANTY; without even the
18 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 # See the License for more information.
20 #=============================================================================
21 # (To distributed this file outside of CMake, substitute the full
22 #  License text for the above reference.)
23
24 INCLUDE(CheckCSourceCompiles)
25
26 MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
27    SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
28    SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
29    CHECK_C_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}
30      # Some compilers do not fail with a bad flag
31      FAIL_REGEX "error: bad value (.*) for .* switch"       # GNU
32      FAIL_REGEX "argument unused during compilation"        # clang
33      FAIL_REGEX "is valid for .* but not for C"             # GNU
34      FAIL_REGEX "unrecognized .*option"                     # GNU
35      FAIL_REGEX "ignoring unknown option"                   # MSVC
36      FAIL_REGEX "[Uu]nknown option"                         # HP
37      FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
38      FAIL_REGEX "command option .* is not recognized"       # XL
39      FAIL_REGEX "WARNING: unknown flag:"                    # Open64
40      FAIL_REGEX " #10159: "                                 # ICC
41      )
42    SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
43 ENDMACRO (CHECK_C_COMPILER_FLAG)
44