More fixes for testsuite generated files
[dyninst.git] / testsuite / checkMutateeCompiler.cmake
1
2 INCLUDE(CheckCSourceCompiles)
3
4 MACRO (CHECK_MUTATEE_COMPILER _COMPILER _COMP_FLAG _LINK_FLAG _RESULT)
5    SET(${_RESULT})
6    SET(SAFE_CMAKE_C_COMPILER "${CMAKE_C_COMPILER}")
7    SET(SAFE_CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
8    SET(SAFE_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
9
10    SET(CMAKE_C_COMPILER "${_COMPILER}")
11    SET(CMAKE_EXE_LINKER_FLAGS "${_LINK_FLAG}")
12    SET(CMAKE_C_FLAGS "${_COMP_FLAG}")
13
14    CHECK_C_SOURCE_COMPILES("#include <signal.h> \n int main(void) { return 0; }" ${_RESULT}
15
16      # Some compilers do not fail with a bad flag
17      FAIL_REGEX "warning: command line option .* is valid for .* but not for C"
18                                                             # Apple gcc
19      FAIL_REGEX "unrecognized .*option"                     # GNU
20      FAIL_REGEX "unknown .*option"                          # Clang
21      FAIL_REGEX "ignoring unknown option"                   # MSVC
22      FAIL_REGEX "warning D9002"                             # MSVC, any lang
23      FAIL_REGEX "[Uu]nknown option"                         # HP
24      FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
25      FAIL_REGEX "command option .* is not recognized"       # XL
26      FAIL_REGEX "cannot find"                               # Missing libraries
27      )
28    SET (CMAKE_C_COMPILER "${SAFE_CMAKE_C_COMPILER}")
29    SET (CMAKE_EXE_LINKER_FLAGS "${SAFE_CMAKE_EXE_LINKER_FLAGS}")
30    SET (CMAKE_C_FLAGS "${SAFE_CMAKE_C_FLAGS}")
31 ENDMACRO (CHECK_MUTATEE_COMPILER)