CMakeCCompilerId.c.in 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifdef __cplusplus
  2. # error "A C++ compiler has been selected for C."
  3. #endif
  4. #if defined(__18CXX)
  5. # define ID_VOID_MAIN
  6. #endif
  7. #if defined(__INTEL_COMPILER) || defined(__ICC)
  8. # define COMPILER_ID "Intel"
  9. #elif defined(__BORLANDC__)
  10. # define COMPILER_ID "Borland"
  11. #elif defined(__WATCOMC__)
  12. # define COMPILER_ID "Watcom"
  13. #elif defined(__SUNPRO_C)
  14. # define COMPILER_ID "SunPro"
  15. #elif defined(__HP_cc)
  16. # define COMPILER_ID "HP"
  17. #elif defined(__DECC)
  18. # define COMPILER_ID "Compaq"
  19. #elif defined(__IBMC__)
  20. # if defined(__COMPILER_VER__)
  21. # define COMPILER_ID "zOS"
  22. # elif __IBMC__ >= 800
  23. # define COMPILER_ID "XL"
  24. # else
  25. # define COMPILER_ID "VisualAge"
  26. # endif
  27. #elif defined(__PGI)
  28. # define COMPILER_ID "PGI"
  29. #elif defined(__GNUC__)
  30. # define COMPILER_ID "GNU"
  31. #elif defined(_MSC_VER)
  32. # define COMPILER_ID "MSVC"
  33. #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
  34. /* Analog Devices C++ compiler for Blackfin, TigerSHARC and
  35. SHARC (21000) DSPs */
  36. # define COMPILER_ID "ADSP"
  37. /* IAR Systems compiler for embedded systems.
  38. http://www.iar.com
  39. Not supported yet by CMake
  40. #elif defined(__IAR_SYSTEMS_ICC__)
  41. # define COMPILER_ID "IAR" */
  42. /* sdcc, the small devices C compiler for embedded systems,
  43. http://sdcc.sourceforge.net */
  44. #elif defined(SDCC)
  45. # define COMPILER_ID "SDCC"
  46. #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
  47. # define COMPILER_ID "MIPSpro"
  48. /* This compiler is either not known or is too old to define an
  49. identification macro. Try to identify the platform and guess that
  50. it is the native compiler. */
  51. #elif defined(__sgi)
  52. # define COMPILER_ID "MIPSpro"
  53. #elif defined(__hpux) || defined(__hpua)
  54. # define COMPILER_ID "HP"
  55. #else /* unknown compiler */
  56. # define COMPILER_ID ""
  57. #endif
  58. /* Construct the string literal in pieces to prevent the source from
  59. getting matched. Store it in a pointer rather than an array
  60. because some compilers will just produce instructions to fill the
  61. array rather than assigning a pointer to a static array. */
  62. char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
  63. @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
  64. /*--------------------------------------------------------------------------*/
  65. #ifdef ID_VOID_MAIN
  66. void main() {}
  67. #else
  68. int main(int argc, char* argv[])
  69. {
  70. int require = 0;
  71. require += info_compiler[argc];
  72. require += info_platform[argc];
  73. (void)argv;
  74. return require;
  75. }
  76. #endif