Features: Detect C default dialect on MSVC-like compilers

These compilers default to C 90 but do not define __STDC__.  While MSVC
itself has no option to change the dialect, compilers that document
compatibility with MSVC and define _MSC_VER may (e.g. Intel).
This commit is contained in:
Brad King 2016-04-15 16:06:41 -04:00
parent fa4ae9fb12
commit 7f401ae43f
1 changed files with 5 additions and 1 deletions

View File

@ -34,7 +34,11 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
@CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@ @CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
#if !defined(__STDC__) #if !defined(__STDC__)
# define C_DIALECT # if defined(_MSC_VER) && !defined(__clang__)
# define C_DIALECT "90"
# else
# define C_DIALECT
# endif
#elif __STDC_VERSION__ >= 201000L #elif __STDC_VERSION__ >= 201000L
# define C_DIALECT "11" # define C_DIALECT "11"
#elif __STDC_VERSION__ >= 199901L #elif __STDC_VERSION__ >= 199901L