CMakeCCompilerId.c.in 2.56 KB
Newer Older
1
2
3
4
#ifdef __cplusplus
# error "A C++ compiler has been selected for C."
#endif

5
6
7
#if defined(__18CXX)
# define ID_VOID_MAIN
#endif
8
9

#if defined(__INTEL_COMPILER) || defined(__ICC)
10
# define COMPILER_ID "Intel"
Alexander Neundorf's avatar
   
Alexander Neundorf committed
11

12
13
14
#elif defined(__clang__)
# define COMPILER_ID "Clang"

15
#elif defined(__BORLANDC__)
16
# define COMPILER_ID "Borland"
Alexander Neundorf's avatar
   
Alexander Neundorf committed
17

18
#elif defined(__WATCOMC__)
19
# define COMPILER_ID "Watcom"
Alexander Neundorf's avatar
   
Alexander Neundorf committed
20

21
#elif defined(__SUNPRO_C)
22
# define COMPILER_ID "SunPro"
Alexander Neundorf's avatar
   
Alexander Neundorf committed
23

24
#elif defined(__HP_cc)
25
# define COMPILER_ID "HP"
Alexander Neundorf's avatar
   
Alexander Neundorf committed
26

27
#elif defined(__DECC)
28
# define COMPILER_ID "Compaq"
Alexander Neundorf's avatar
   
Alexander Neundorf committed
29

30
#elif defined(__IBMC__)
31
32
33
34
35
36
37
# if defined(__COMPILER_VER__)
#  define COMPILER_ID "zOS"
# elif __IBMC__ >= 800
#  define COMPILER_ID "XL"
# else
#  define COMPILER_ID "VisualAge"
# endif
Alexander Neundorf's avatar
   
Alexander Neundorf committed
38

Alexander Neundorf's avatar
   
Alexander Neundorf committed
39
40
41
#elif defined(__PGI)
# define COMPILER_ID "PGI"

42
43
44
#elif defined(__PATHSCALE__)
# define COMPILER_ID "PathScale"

45
46
47
#elif defined(_CRAYC)
# define COMPILER_ID "Cray"

48
#elif defined(__GNUC__)
49
# define COMPILER_ID "GNU"
Alexander Neundorf's avatar
   
Alexander Neundorf committed
50

51
#elif defined(_MSC_VER)
52
# define COMPILER_ID "MSVC"
Alexander Neundorf's avatar
   
Alexander Neundorf committed
53

Alexander Neundorf's avatar
   
Alexander Neundorf committed
54
#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
55
/* Analog Devices C++ compiler for Blackfin, TigerSHARC and
Alexander Neundorf's avatar
   
Alexander Neundorf committed
56
57
58
   SHARC (21000) DSPs */
# define COMPILER_ID "ADSP"

Alexander Neundorf's avatar
   
Alexander Neundorf committed
59
60
/* IAR Systems compiler for embedded systems.
   http://www.iar.com
Alexander Neundorf's avatar
   
Alexander Neundorf committed
61
   Not supported yet by CMake
Alexander Neundorf's avatar
   
Alexander Neundorf committed
62
#elif defined(__IAR_SYSTEMS_ICC__)
Alexander Neundorf's avatar
   
Alexander Neundorf committed
63
# define COMPILER_ID "IAR" */
Alexander Neundorf's avatar
   
Alexander Neundorf committed
64

65
/* sdcc, the small devices C compiler for embedded systems,
Alexander Neundorf's avatar
   
Alexander Neundorf committed
66
   http://sdcc.sourceforge.net  */
Alexander Neundorf's avatar
   
Alexander Neundorf committed
67
#elif defined(SDCC)
Alexander Neundorf's avatar
   
Alexander Neundorf committed
68
# define COMPILER_ID "SDCC"
Alexander Neundorf's avatar
   
Alexander Neundorf committed
69

70
#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
71
# define COMPILER_ID "MIPSpro"
72
73
74
75
76

/* This compiler is either not known or is too old to define an
   identification macro.  Try to identify the platform and guess that
   it is the native compiler.  */
#elif defined(__sgi)
77
# define COMPILER_ID "MIPSpro"
Alexander Neundorf's avatar
   
Alexander Neundorf committed
78

79
#elif defined(__hpux) || defined(__hpua)
80
# define COMPILER_ID "HP"
81
82

#else /* unknown compiler */
83
84
# define COMPILER_ID ""

85
#endif
Alexander Neundorf's avatar
   
Alexander Neundorf committed
86

87
88
89
90
91
/* Construct the string literal in pieces to prevent the source from
   getting matched.  Store it in a pointer rather than an array
   because some compilers will just produce instructions to fill the
   array rather than assigning a pointer to a static array.  */
char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
92

93
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
94
95
96
97
98
99
100
101
102
103
104

/*--------------------------------------------------------------------------*/

#ifdef ID_VOID_MAIN
void main() {}
#else
int main(int argc, char* argv[])
{
  int require = 0;
  require += info_compiler[argc];
  require += info_platform[argc];
105
  require += info_arch[argc];
106
107
108
109
  (void)argv;
  return require;
}
#endif