cmake/Modules/CMakeCXXCompilerId.cpp.in

106 lines
2.8 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
2021-09-14 00:13:48 +02:00
#if !defined(__has_include)
/* If the compiler does not have __has_include, pretend the answer is
always no. */
# define __has_include(x) 0
#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
2021-09-14 00:13:48 +02:00
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
2016-03-13 13:35:51 +01:00
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@
2020-02-01 23:06:01 +01:00
#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
# if defined(__INTEL_CXX11_MODE__)
# if defined(__cpp_aggregate_nsdmi)
# define CXX_STD 201402L
# else
# define CXX_STD 201103L
# endif
# else
# define CXX_STD 199711L
# endif
#elif defined(_MSC_VER) && defined(_MSVC_LANG)
# define CXX_STD _MSVC_LANG
2018-01-26 17:06:56 +01:00
#else
2020-02-01 23:06:01 +01:00
# define CXX_STD __cplusplus
2018-01-26 17:06:56 +01:00
#endif
2021-11-20 13:41:27 +01:00
const char* info_language_standard_default = "INFO" ":" "standard_default["
2021-09-14 00:13:48 +02:00
#if CXX_STD > 202002L
"23"
#elif CXX_STD > 201703L
2018-08-09 18:06:22 +02:00
"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
"]";
2021-11-20 13:41:27 +01:00
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
2022-03-29 21:10:50 +02:00
#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
2021-11-20 13:41:27 +01:00
defined(__TI_COMPILER_VERSION__)) && \
2022-03-29 21:10:50 +02:00
!defined(__STRICT_ANSI__)
2021-11-20 13:41:27 +01:00
"ON"
#else
"OFF"
#endif
"]";
/*--------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
int require = 0;
require += info_compiler[argc];
require += info_platform[argc];
2022-11-16 20:14:03 +01:00
require += info_arch[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
2021-09-14 00:13:48 +02:00
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
2016-03-13 13:35:51 +01:00
require += info_cray[argc];
2012-04-19 19:04:21 +03:00
#endif
2021-11-20 13:41:27 +01:00
require += info_language_standard_default[argc];
require += info_language_extensions_default[argc];
(void)argv;
return require;
}