CMakeCXXCompilerId.cpp.in 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. @CMAKE_CXX_COMPILER_ID_CONTENT@
  8. /* Construct the string literal in pieces to prevent the source from
  9. getting matched. Store it in a pointer rather than an array
  10. because some compilers will just produce instructions to fill the
  11. array rather than assigning a pointer to a static array. */
  12. char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
  13. #ifdef SIMULATE_ID
  14. char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
  15. #endif
  16. #ifdef __QNXNTO__
  17. char const* qnxnto = "INFO" ":" "qnxnto[]";
  18. #endif
  19. #if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
  20. char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
  21. #endif
  22. @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
  23. @CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@
  24. #if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
  25. # if defined(__INTEL_CXX11_MODE__)
  26. # if defined(__cpp_aggregate_nsdmi)
  27. # define CXX_STD 201402L
  28. # else
  29. # define CXX_STD 201103L
  30. # endif
  31. # else
  32. # define CXX_STD 199711L
  33. # endif
  34. #elif defined(_MSC_VER) && defined(_MSVC_LANG)
  35. # define CXX_STD _MSVC_LANG
  36. #else
  37. # define CXX_STD __cplusplus
  38. #endif
  39. const char* info_language_dialect_default = "INFO" ":" "dialect_default["
  40. #if CXX_STD > 202002L
  41. "23"
  42. #elif CXX_STD > 201703L
  43. "20"
  44. #elif CXX_STD >= 201703L
  45. "17"
  46. #elif CXX_STD >= 201402L
  47. "14"
  48. #elif CXX_STD >= 201103L
  49. "11"
  50. #else
  51. "98"
  52. #endif
  53. "]";
  54. /*--------------------------------------------------------------------------*/
  55. int main(int argc, char* argv[])
  56. {
  57. int require = 0;
  58. require += info_compiler[argc];
  59. require += info_platform[argc];
  60. #ifdef COMPILER_VERSION_MAJOR
  61. require += info_version[argc];
  62. #endif
  63. #ifdef COMPILER_VERSION_INTERNAL
  64. require += info_version_internal[argc];
  65. #endif
  66. #ifdef SIMULATE_ID
  67. require += info_simulate[argc];
  68. #endif
  69. #ifdef SIMULATE_VERSION_MAJOR
  70. require += info_simulate_version[argc];
  71. #endif
  72. #if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
  73. require += info_cray[argc];
  74. #endif
  75. require += info_language_dialect_default[argc];
  76. (void)argv;
  77. return require;
  78. }