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