[cmake-developers] Add CXX_STANDARD support for Intel C++ compilers
Levi Morrison
morrison.levi at gmail.com
Wed Nov 18 20:00:02 EST 2015
On Wed, Nov 18, 2015 at 3:34 PM, Levi Morrison <morrison.levi at gmail.com>
wrote:
> On Wed, Nov 18, 2015 at 1:06 PM, Brad King <brad.king at kitware.com> wrote:
>
>> On 11/18/2015 02:32 PM, Levi Morrison wrote:
>> > After some other tweaks I am able to get Intel C++ compiler versions
>> > 12.1.4 13.0.1, 14.0.0, 14.0.2, 15.0.0, 15.0.2, 15.0.3 to work!
>> > Both tests found by `ctest -R CompileFeatures -VV` pass.
>>
>> Great. However, the concern I raised earlier about detecting
>> C++11 features in C++14 mode has not been addressed. For example:
>>
>> set(Intel14_CXX11 "__ICC >= 1400 && __INTEL_CXX11_MODE__")
>>
>> In C++14 mode this check fails so all the conditional features are
>> detected to not exist. Tests/CompileFeatures/CMakeFiles/CMakeOutput.log
>> shows:
>>
>> Detecting CXX [-std=c++1y] compiler features compiled with the following
>> output:
>> ...
>> Feature record: CXX_FEATURE:0cxx_defaulted_move_initializers
>> ...
>> Detecting CXX [-std=c++11] compiler features compiled with the following
>> output:
>> ...
>> Feature record: CXX_FEATURE:1cxx_defaulted_move_initializers
>>
>> The "0" and "1" are an internal detection code encoding for whether
>> the feature exists according to the feature test specified. We see
>> that the C++14 mode does not think the feature exists. This is not
>> the case for GNU or other compilers.
>>
>> I'm not sure why this doesn't cause problems in the test, but the
>> conditions need to be fixed to avoid this problem. __INTEL_CXX11_MODE__
>> only tells us that we are in *exactly* C++11 mode and so is not
>> reliable for detecting C++11 features in C++14 mode.
>>
>> -Brad
>>
>>
> My builds don't seem to be attempting this:
>
> Detecting CXX [-std=c++1y] compiler features compiled with the following
>> output
>
>
> You are getting this out of the CMakeFiles/CMakeOutput.log, correct?
>
I'm not sure why that was happening – I get this in my output now.
I am experimenting with definitions that look like this:
set(DETECT_CXX11 "((__cplusplus >= 201103L) ||
> defined(__INTEL_CXX11_MODE__) || defined(__GXX_EXPERIMENTAL_CXX0X__))")
> set(DETECT_CXX14 "((__cplusplus >= 201103L) &&
> !defined(__INTEL_CXX11_MODE__))")
I then use these with __ICC checks as appropriate:
set(Intel15_CXX14 "__ICC >= 1500 && ${DETECT_CXX14}")
At a glance this seems to fix the issues in all versions. I will comb
through the output again later when I have a fresh mind.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20151118/2bff5dd4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-CXX_STANDARD-support-to-Intel-C-compilers.patch
Type: application/octet-stream
Size: 11719 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20151118/2bff5dd4/attachment-0001.obj>
More information about the cmake-developers
mailing list