Skip to content

Inappropriate version comparison of Intel Fortran in CMakeLists.txt  #443

Open
@degawa

Description

@degawa

To switch a compiler option for specifying the Fortran standard, CMake processes the following statements:

  add_compile_options(-warn declarations,general,usage,interfaces,unused)
  if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 18.0)
    add_compile_options(-stand f15)
  else()
    add_compile_options(-stand f18)
  endif()

The version comparison operator VERSION_LESS used here corresponds to <, so -stand f18 is specified for Intel Fortran 18.0 and later. However, Intel Fortran 18 does not have the keyword f18 for -stand option.
It can be confirmed from references:

I found a version comparison operator VERSION_LESS_EQUAL corresponding to <=.
It would be better to use it instead of VERSION_LESS.

  add_compile_options(-warn declarations,general,usage,interfaces,unused)
  if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS_EQUAL 18.0)
    add_compile_options(-stand f15)
  else()
    add_compile_options(-stand f18)
  endif()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbuild: cmakeIssue with stdlib's CMake build filescompiler: ifortSpecific to Intel Fortran compilerswontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions