CMake/Modules/Compiler/Intel-C-FeatureTests.cmake
Brad King 369d580937 Features: Record features for Intel Compiler on Windows
Since this compiler always defines `__cplusplus` to `1` we need to use
`_MSC_VER`, `__INTEL_CXX11_MODE__`, and the feature test macro named
`__cpp_aggregate_nsdmi` to detect C++11 and C++14 modes.

With no `-Qstd=` flag this compiler defaults to C++98 plus a subset of
C++11/C++14 features needed to be compatible with MSVC.  We pretend it
is plain C++98 and add a `-Qstd=` flag whenever needed for C++11 or
above features even if they would happen to be available in MSVC-mode.

Closes: #16384
2016-10-27 13:33:10 -04:00

21 lines
1.0 KiB
CMake

# References:
# - https://software.intel.com/en-us/articles/iso-iec-standards-language-conformance-for-intel-c-compiler
# - https://software.intel.com/en-us/articles/c99-support-in-intel-c-compiler
# - https://software.intel.com/en-us/articles/c11-support-in-intel-c-compiler
set(DETECT_C99 "defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L")
set(DETECT_C11 "defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L")
#static assert is only around in version 1500 update 2 and above
set(_cmake_feature_test_c_static_assert "(__INTEL_COMPILER > 1500 || (__INTEL_COMPILER == 1500 && __INTEL_COMPILER_UPDATE > 1) ) && (${DETECT_C11} || ${DETECT_C99} && !defined(_MSC_VER))")
set(_cmake_oldestSupported "__INTEL_COMPILER >= 1110")
set(Intel_C99 "${_cmake_oldestSupported} && ${DETECT_C99}")
set(_cmake_feature_test_c_restrict "${Intel_C99}")
set(_cmake_feature_test_c_variadic_macros "${Intel_C99}")
set(_cmake_feature_test_c_function_prototypes "${_cmake_oldestSupported}")
unset(Intel_C99)
unset(DETECT_C99)
unset(DETECT_C11)