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

Brad King brad.king at kitware.com
Thu Nov 19 10:41:02 EST 2015


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

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.

Thanks,
-Brad



More information about the cmake-developers mailing list