CMakeCXXCompilerId.cpp.in 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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(__CRAYXE) || defined(__CRAYXC)
  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 > 201703L
  41. "20"
  42. #elif CXX_STD >= 201703L
  43. "17"
  44. #elif CXX_STD >= 201402L
  45. "14"
  46. #elif CXX_STD >= 201103L
  47. "11"
  48. #else
  49. "98"
  50. #endif
  51. "]";
  52. /*--------------------------------------------------------------------------*/
  53. int main(int argc, char* argv[])
  54. {
  55. int require = 0;
  56. require += info_compiler[argc];
  57. require += info_platform[argc];
  58. #ifdef COMPILER_VERSION_MAJOR
  59. require += info_version[argc];
  60. #endif
  61. #ifdef COMPILER_VERSION_INTERNAL
  62. require += info_version_internal[argc];
  63. #endif
  64. #ifdef SIMULATE_ID
  65. require += info_simulate[argc];
  66. #endif
  67. #ifdef SIMULATE_VERSION_MAJOR
  68. require += info_simulate_version[argc];
  69. #endif
  70. #if defined(__CRAYXE) || defined(__CRAYXC)
  71. require += info_cray[argc];
  72. #endif
  73. require += info_language_dialect_default[argc];
  74. (void)argv;
  75. return require;
  76. }