CMakeCCompilerId.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifdef __cplusplus
  2. # error "A C++ compiler has been selected for C."
  3. #endif
  4. #ifdef __CLASSIC_C__
  5. # define const
  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. # define COMPILER_ID "VisualAge"
  21. #elif defined(__GNUC__)
  22. # define COMPILER_ID "GNU"
  23. #elif defined(_MSC_VER)
  24. # define COMPILER_ID "MSVC"
  25. #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
  26. /* Analog Devices C++ compiler for Blackfin, TigerSHARC and
  27. SHARC (21000) DSPs */
  28. # define COMPILER_ID "ADSP"
  29. /* IAR Systems compiler for embedded systems.
  30. http://www.iar.com
  31. Not supported yet by CMake
  32. #elif defined(__IAR_SYSTEMS_ICC__)
  33. # define COMPILER_ID "IAR" */
  34. /* sdcc, the small devices C compiler for embedded systems,
  35. http://sdcc.sourceforge.net */
  36. #elif defined(SDCC)
  37. # define COMPILER_ID "SDCC"
  38. #elif defined(_COMPILER_VERSION)
  39. # define COMPILER_ID "MIPSpro"
  40. /* This compiler is either not known or is too old to define an
  41. identification macro. Try to identify the platform and guess that
  42. it is the native compiler. */
  43. #elif defined(__sgi)
  44. # define COMPILER_ID "MIPSpro"
  45. #elif defined(__hpux) || defined(__hpua)
  46. # define COMPILER_ID "HP"
  47. #else /* unknown compiler */
  48. # define COMPILER_ID ""
  49. #endif
  50. static char const info_compiler[] = "INFO:compiler[" COMPILER_ID "]";
  51. /* Include the platform identification source. */
  52. #include "CMakePlatformId.h"
  53. /* Make sure the information strings are referenced. */
  54. int main()
  55. {
  56. return (&info_compiler[0] != &info_platform[0]);
  57. }