[cmake-developers] Add CXX_STANDARD support for Intel C++ compilers

Levi Morrison morrison.levi at gmail.com
Mon Nov 30 13:18:42 EST 2015


On Thu, Nov 19, 2015 at 9:28 AM, Levi Morrison <morrison.levi at gmail.com> wrote:
> On Thu, Nov 19, 2015 at 8:41 AM, Brad King <brad.king at kitware.com> wrote:
>>
>> On 11/18/2015 08:00 PM, Levi Morrison wrote:
>> > 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.
>>
>> Great!
>>
>> > +if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0)
>> > +  set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
>> > +  set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
>> > +
>> > +  if (NOT CMAKE_CXX_COMPILER_FORCED)
>> > +    if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
>> > +      set(CMAKE_CXX_STANDARD_DEFAULT 98)
>> > +    else()
>> > +      set(CMAKE_CXX_STANDARD_DEFAULT
>> > ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
>> > +    endif()
>> > +  endif()
>> > +endif()
>>
>> Please revise selection of CMAKE_CXX_STANDARD_DEFAULT to look
>> like those here:
>>
>>
>> https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Compiler/GNU-C.cmake;hb=441dba80#l25
>>
>> https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Compiler/GNU-CXX.cmake;hb=441dba80#l37
>
>
> Ah, I was wondering if you would mention that. At the time, at least, it
> always failed. I have since fixed a lot of issues so I will try it again.
>
>>
>> See also the fix to those I just made:
>>
>>  Project: Guess default standard dialect if compiler was forced (#15852)
>>  https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=441dba80
>>
>> Basically we need to require CMAKE_CXX_STANDARD_COMPUTED_DEFAULT
>> to be computed correctly unless the compiler id was forced, in
>> which case we need to fall back to a memorized table of default
>> versions.  Modules/CMakeCXXCompilerId.cpp.in may also need to be
>> updated to set `dialect_default` correctly for the Intel compiler
>> versions that do not set `__cplusplus` correctly for C++14 mode.
>
>
> Ah… this would explain why the previous stuff always failed. The
> dialect_default almost certainly needs to be updated; thank you.

My latest patch is attached. All tests seem to be working for me on
the compiler versions I have access to. Can you check it for any
glaring errors?
-------------- 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/20151130/aa8874c6/attachment-0001.obj>


More information about the cmake-developers mailing list