CMakeCXXCompilerId.cpp.in 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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(_MSC_VER) && defined(_MSVC_LANG)
  25. #define CXX_STD _MSVC_LANG
  26. #else
  27. #define CXX_STD __cplusplus
  28. #endif
  29. const char* info_language_dialect_default = "INFO" ":" "dialect_default["
  30. #if CXX_STD > 201402L
  31. "17"
  32. #elif CXX_STD >= 201402L
  33. "14"
  34. #elif CXX_STD >= 201103L
  35. "11"
  36. #else
  37. "98"
  38. #endif
  39. "]";
  40. /*--------------------------------------------------------------------------*/
  41. int main(int argc, char* argv[])
  42. {
  43. int require = 0;
  44. require += info_compiler[argc];
  45. require += info_platform[argc];
  46. #ifdef COMPILER_VERSION_MAJOR
  47. require += info_version[argc];
  48. #endif
  49. #ifdef COMPILER_VERSION_INTERNAL
  50. require += info_version_internal[argc];
  51. #endif
  52. #ifdef SIMULATE_ID
  53. require += info_simulate[argc];
  54. #endif
  55. #ifdef SIMULATE_VERSION_MAJOR
  56. require += info_simulate_version[argc];
  57. #endif
  58. #if defined(__CRAYXE) || defined(__CRAYXC)
  59. require += info_cray[argc];
  60. #endif
  61. require += info_language_dialect_default[argc];
  62. (void)argv;
  63. return require;
  64. }