cmake/Modules/CMakeCXXCompilerId.cpp.in

76 lines
1.9 KiB
C++
Raw Normal View History

/* 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. */
#ifndef __cplusplus
# error "A C compiler has been selected for C++."
#endif
2015-04-27 22:25:09 +02:00
@CMAKE_CXX_COMPILER_ID_CONTENT@
/* 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. */
2011-01-16 11:35:12 +01:00
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
2014-08-03 19:52:23 +02:00
#ifdef SIMULATE_ID
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
#endif
#ifdef __QNXNTO__
2015-04-27 22:25:09 +02:00
char const* qnxnto = "INFO" ":" "qnxnto[]";
2014-08-03 19:52:23 +02:00
#endif
2016-03-13 13:35:51 +01:00
#if defined(__CRAYXE) || defined(__CRAYXC)
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
#endif
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
2014-08-03 19:52:23 +02:00
@CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@
2018-01-26 17:06:56 +01:00
#if defined(_MSC_VER) && defined(_MSVC_LANG)
#define CXX_STD _MSVC_LANG
#else
#define CXX_STD __cplusplus
#endif
2015-11-17 17:22:37 +01:00
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
2018-08-09 18:06:22 +02:00
#if CXX_STD > 201703L
"20"
#elif CXX_STD >= 201703L
2017-04-14 19:02:05 +02:00
"17"
2018-01-26 17:06:56 +01:00
#elif CXX_STD >= 201402L
2015-11-17 17:22:37 +01:00
"14"
2018-01-26 17:06:56 +01:00
#elif CXX_STD >= 201103L
2015-11-17 17:22:37 +01:00
"11"
#else
"98"
#endif
"]";
/*--------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
int require = 0;
require += info_compiler[argc];
require += info_platform[argc];
2012-04-19 19:04:21 +03:00
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
2014-08-03 19:52:23 +02:00
#endif
2018-01-26 17:06:56 +01:00
#ifdef COMPILER_VERSION_INTERNAL
require += info_version_internal[argc];
#endif
2014-08-03 19:52:23 +02:00
#ifdef SIMULATE_ID
require += info_simulate[argc];
#endif
#ifdef SIMULATE_VERSION_MAJOR
require += info_simulate_version[argc];
2016-03-13 13:35:51 +01:00
#endif
#if defined(__CRAYXE) || defined(__CRAYXC)
require += info_cray[argc];
2012-04-19 19:04:21 +03:00
#endif
2015-12-03 18:43:53 +01:00
require += info_language_dialect_default[argc];
(void)argv;
return require;
}