mirror of
https://github.com/reactos/CMake.git
synced 2025-02-04 02:47:29 +00:00
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
This commit is contained in:
parent
a5a3642f92
commit
369d580937
@ -309,4 +309,4 @@ versions specified for each:
|
||||
* ``GNU``: GNU compiler versions 4.4 through 5.0.
|
||||
* ``MSVC``: Microsoft Visual Studio versions 2010 through 2015.
|
||||
* ``SunPro``: Oracle SolarisStudio version 12.4.
|
||||
* ``Intel``: Intel compiler versions 12.1 through 16.0 on UNIX platforms.
|
||||
* ``Intel``: Intel compiler versions 12.1 through 17.0.
|
||||
|
6
Help/release/dev/intel-compile-features-windows.rst
Normal file
6
Help/release/dev/intel-compile-features-windows.rst
Normal file
@ -0,0 +1,6 @@
|
||||
intel-compile-features-windows
|
||||
------------------------------
|
||||
|
||||
* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
|
||||
is now aware of features supported by Intel C++ compilers versions 12.1
|
||||
through 17.0 on UNIX and Windows platforms.
|
@ -3,15 +3,11 @@
|
||||
# - 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
|
||||
|
||||
# FIXME: Intel C feature detection works only when simulating the GNU compiler.
|
||||
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
return()
|
||||
endif()
|
||||
|
||||
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_C99}")
|
||||
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}")
|
||||
@ -21,3 +17,4 @@ set(_cmake_feature_test_c_function_prototypes "${_cmake_oldestSupported}")
|
||||
unset(Intel_C99)
|
||||
|
||||
unset(DETECT_C99)
|
||||
unset(DETECT_C11)
|
||||
|
@ -52,8 +52,7 @@ macro(cmake_record_c_compile_features)
|
||||
endmacro()
|
||||
|
||||
set(_result 0)
|
||||
if (NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" AND
|
||||
NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1)
|
||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
|
||||
_get_intel_c_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
|
||||
endif()
|
||||
|
@ -12,12 +12,6 @@
|
||||
# - __cpp_rvalue_references 200610
|
||||
# - __cpp_variadic_templates 200704
|
||||
|
||||
# FIXME: Intel C++ feature detection works only when simulating the GNU compiler.
|
||||
# When simulating MSVC, Intel always sets __cplusplus to 199711L.
|
||||
if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(_cmake_feature_test_cxx_variable_templates "__cpp_variable_templates >= 201304")
|
||||
set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304")
|
||||
|
||||
@ -27,7 +21,7 @@ set(DETECT_CXX11 "((__cplusplus >= 201103L) || defined(__INTEL_CXX11_MODE__) ||
|
||||
#if you are compiling as 98/11/14. So to properly detect C++14 with this version
|
||||
#we look for the existence of __GXX_EXPERIMENTAL_CXX0X__ but not __INTEL_CXX11_MODE__
|
||||
set(DETECT_BUGGY_ICC15 "((__INTEL_COMPILER == 1500) && (__INTEL_COMPILER_UPDATE == 1))")
|
||||
set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !defined(__INTEL_CXX11_MODE__)) || ((${DETECT_BUGGY_ICC15}) && defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__INTEL_CXX11_MODE__) ) )")
|
||||
set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !defined(__INTEL_CXX11_MODE__)) || ((${DETECT_BUGGY_ICC15}) && defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__INTEL_CXX11_MODE__) ) || (defined(_MSC_VER) && defined(__INTEL_CXX11_MODE__) && defined(__cpp_aggregate_nsdmi)) )")
|
||||
unset(DETECT_BUGGY_ICC15)
|
||||
|
||||
set(Intel16_CXX14 "__INTEL_COMPILER >= 1600 && ${DETECT_CXX14}")
|
||||
@ -61,7 +55,7 @@ unset(Intel15_CXX11)
|
||||
|
||||
set(Intel14_CXX11 "${DETECT_CXX11} && (__INTEL_COMPILER > 1400 || (__INTEL_COMPILER == 1400 && __INTEL_COMPILER_UPDATE >= 2))")
|
||||
# Documented as 12.0+ but in testing it only works on 14.0.2+
|
||||
set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${Intel14_CXX11}")
|
||||
set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${Intel14_CXX11} && !defined(_MSC_VER)")
|
||||
|
||||
set(Intel14_CXX11 "__INTEL_COMPILER >= 1400 && ${DETECT_CXX11}")
|
||||
set(_cmake_feature_test_cxx_delegating_constructors "${Intel14_CXX11}")
|
||||
|
@ -65,8 +65,7 @@ macro(cmake_record_cxx_compile_features)
|
||||
endmacro()
|
||||
|
||||
set(_result 0)
|
||||
if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND
|
||||
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
|
||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)
|
||||
_get_intel_features("${CMAKE_CXX14_STANDARD_COMPILE_OPTION}" CMAKE_CXX14_COMPILE_FEATURES)
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user