CMakeOBJCXXCompilerId.mm.in 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 "An Objective-C compiler has been selected for Objective-C++."
  6. #endif
  7. @CMAKE_OBJCXX_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. @CMAKE_OBJCXX_COMPILER_ID_PLATFORM_CONTENT@
  20. @CMAKE_OBJCXX_COMPILER_ID_ERROR_FOR_TEST@
  21. #if defined(_MSC_VER) && defined(_MSVC_LANG)
  22. #define CXX_STD _MSVC_LANG
  23. #else
  24. #define CXX_STD __cplusplus
  25. #endif
  26. const char* info_language_standard_default = "INFO" ":" "standard_default["
  27. #if CXX_STD > 202002L
  28. "23"
  29. #elfif CXX_STD > 201703L
  30. "20"
  31. #elif CXX_STD >= 201703L
  32. "17"
  33. #elif CXX_STD >= 201402L
  34. "14"
  35. #elif CXX_STD >= 201103L
  36. "11"
  37. #else
  38. "98"
  39. #endif
  40. "]";
  41. const char* info_language_extensions_default = "INFO" ":" "extensions_default["
  42. #if (defined(__clang__) || defined(__GNUC__)) && !defined(__STRICT_ANSI__)
  43. "ON"
  44. #else
  45. "OFF"
  46. #endif
  47. "]";
  48. /*--------------------------------------------------------------------------*/
  49. int main(int argc, char* argv[])
  50. {
  51. int require = 0;
  52. require += info_compiler[argc];
  53. require += info_platform[argc];
  54. #ifdef COMPILER_VERSION_MAJOR
  55. require += info_version[argc];
  56. #endif
  57. #ifdef COMPILER_VERSION_INTERNAL
  58. require += info_version_internal[argc];
  59. #endif
  60. #ifdef SIMULATE_ID
  61. require += info_simulate[argc];
  62. #endif
  63. #ifdef SIMULATE_VERSION_MAJOR
  64. require += info_simulate_version[argc];
  65. #endif
  66. require += info_language_standard_default[argc];
  67. require += info_language_extensions_default[argc];
  68. (void)argv;
  69. return require;
  70. }