summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-10-26 19:02:35 (GMT)
committerBrad King <brad.king@kitware.com>2016-10-27 17:33:10 (GMT)
commit369d580937b49c1c5672ba3512c2a736581d545c (patch)
tree67a6b2cd1cbdee00edafd960094d484aa1f017f9
parenta5a3642f9292bb697176aaf1077fc98302f286b7 (diff)
downloadCMake-369d580937b49c1c5672ba3512c2a736581d545c.zip
CMake-369d580937b49c1c5672ba3512c2a736581d545c.tar.gz
CMake-369d580937b49c1c5672ba3512c2a736581d545c.tar.bz2
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
-rw-r--r--Help/manual/cmake-compile-features.7.rst2
-rw-r--r--Help/release/dev/intel-compile-features-windows.rst6
-rw-r--r--Modules/Compiler/Intel-C-FeatureTests.cmake9
-rw-r--r--Modules/Compiler/Intel-C.cmake3
-rw-r--r--Modules/Compiler/Intel-CXX-FeatureTests.cmake10
-rw-r--r--Modules/Compiler/Intel-CXX.cmake3
6 files changed, 14 insertions, 19 deletions
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst
index 7289e61..9862d4a 100644
--- a/Help/manual/cmake-compile-features.7.rst
+++ b/Help/manual/cmake-compile-features.7.rst
@@ -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.
diff --git a/Help/release/dev/intel-compile-features-windows.rst b/Help/release/dev/intel-compile-features-windows.rst
new file mode 100644
index 0000000..6a2cdfe
--- /dev/null
+++ b/Help/release/dev/intel-compile-features-windows.rst
@@ -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.
diff --git a/Modules/Compiler/Intel-C-FeatureTests.cmake b/Modules/Compiler/Intel-C-FeatureTests.cmake
index 34175c8..5d09767 100644
--- a/Modules/Compiler/Intel-C-FeatureTests.cmake
+++ b/Modules/Compiler/Intel-C-FeatureTests.cmake
@@ -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)
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index 61adf40..5815857 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -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()
diff --git a/Modules/Compiler/Intel-CXX-FeatureTests.cmake b/Modules/Compiler/Intel-CXX-FeatureTests.cmake
index 71641ff..5b74fab 100644
--- a/Modules/Compiler/Intel-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/Intel-CXX-FeatureTests.cmake
@@ -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}")
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index 63081cc..b6bc2ee 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -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()