CMakeCXXCompilerId.cpp.in 1.92 KB
Newer Older
1 2 3
/* This source file must have a .cpp extension so that all C++ compilers
   recognize the extension without flags.  Borland does not know .cxx for
   example.  */
4 5 6 7
#ifndef __cplusplus
# error "A C compiler has been selected for C++."
#endif

8
@CMAKE_CXX_COMPILER_ID_CONTENT@
9

10 11 12 13
/* Construct the string literal in pieces to prevent the source from
   getting matched.  Store it in a pointer rather than an array
   because some compilers will just produce instructions to fill the
   array rather than assigning a pointer to a static array.  */
14
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
15 16 17
#ifdef SIMULATE_ID
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
#endif
18

19
#ifdef __QNXNTO__
20
char const* qnxnto = "INFO" ":" "qnxnto[]";
21 22
#endif

23 24 25 26
#if defined(__CRAYXE) || defined(__CRAYXC)
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
#endif

27
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
28
@CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@
29

30 31 32 33 34 35
#if defined(_MSC_VER) && defined(_MSVC_LANG)
#define CXX_STD _MSVC_LANG
#else
#define CXX_STD __cplusplus
#endif

36
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
37 38 39
#if CXX_STD > 201703L
  "20"
#elif CXX_STD >= 201703L
40
  "17"
41
#elif CXX_STD >= 201402L
42
  "14"
43
#elif CXX_STD >= 201103L
44 45 46 47 48 49
  "11"
#else
  "98"
#endif
"]";

50 51 52 53 54 55 56
/*--------------------------------------------------------------------------*/

int main(int argc, char* argv[])
{
  int require = 0;
  require += info_compiler[argc];
  require += info_platform[argc];
57 58
#ifdef COMPILER_VERSION_MAJOR
  require += info_version[argc];
59
#endif
60 61 62
#ifdef COMPILER_VERSION_INTERNAL
  require += info_version_internal[argc];
#endif
63 64 65 66 67
#ifdef SIMULATE_ID
  require += info_simulate[argc];
#endif
#ifdef SIMULATE_VERSION_MAJOR
  require += info_simulate_version[argc];
68 69 70
#endif
#if defined(__CRAYXE) || defined(__CRAYXC)
  require += info_cray[argc];
71
#endif
72
  require += info_language_dialect_default[argc];
73 74 75
  (void)argv;
  return require;
}