CMakeCXXCompilerId.cpp.in 2.4 KB

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