CMakeCXXCompilerId.cpp.in 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* This source file must have a .cpp extension so that all C++ compilers
  2. recognize the extension without flags. Borland does not know .cxx for
  3. example. */
  4. #ifndef __cplusplus
  5. # error "A C compiler has been selected for C++."
  6. #endif
  7. #if defined(__COMO__)
  8. # define COMPILER_ID "Comeau"
  9. #elif defined(__INTEL_COMPILER) || defined(__ICC)
  10. # define COMPILER_ID "Intel"
  11. #elif defined(__BORLANDC__)
  12. # define COMPILER_ID "Borland"
  13. #elif defined(__WATCOMC__)
  14. # define COMPILER_ID "Watcom"
  15. #elif defined(__SUNPRO_CC)
  16. # define COMPILER_ID "SunPro"
  17. #elif defined(__HP_aCC)
  18. # define COMPILER_ID "HP"
  19. #elif defined(__DECCXX)
  20. # define COMPILER_ID "Compaq"
  21. #elif defined(__IBMCPP__)
  22. # if defined(__COMPILER_VER__)
  23. # define COMPILER_ID "zOS"
  24. # elif __IBMCPP__ >= 800
  25. # define COMPILER_ID "XL"
  26. # else
  27. # define COMPILER_ID "VisualAge"
  28. # endif
  29. #elif defined(__PGI)
  30. # define COMPILER_ID "PGI"
  31. #elif defined(__GNUC__)
  32. # define COMPILER_ID "GNU"
  33. #elif defined(_MSC_VER)
  34. # define COMPILER_ID "MSVC"
  35. #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
  36. /* Analog Devices C++ compiler for Blackfin, TigerSHARC and
  37. SHARC (21000) DSPs */
  38. # define COMPILER_ID "ADSP"
  39. #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
  40. # define COMPILER_ID "MIPSpro"
  41. /* This compiler is either not known or is too old to define an
  42. identification macro. Try to identify the platform and guess that
  43. it is the native compiler. */
  44. #elif defined(__sgi)
  45. # define COMPILER_ID "MIPSpro"
  46. #elif defined(__hpux) || defined(__hpua)
  47. # define COMPILER_ID "HP"
  48. #else /* unknown compiler */
  49. # define COMPILER_ID ""
  50. #endif
  51. /* Construct the string literal in pieces to prevent the source from
  52. getting matched. Store it in a pointer rather than an array
  53. because some compilers will just produce instructions to fill the
  54. array rather than assigning a pointer to a static array. */
  55. char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
  56. @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
  57. /*--------------------------------------------------------------------------*/
  58. int main(int argc, char* argv[])
  59. {
  60. int require = 0;
  61. require += info_compiler[argc];
  62. require += info_platform[argc];
  63. (void)argv;
  64. return require;
  65. }