[flang-dev] Flang + CMake

Michael Kruse via flang-dev flang-dev at lists.llvm.org
Thu Jul 1 08:55:08 PDT 2021


Am Do., 1. Juli 2021 um 08:20 Uhr schrieb Andrzej Warzynski
<andrzej.warzynski at arm.com>:
> These upper-case predefinitions were added to CMake long before LLVM
> Flang [1]. I think that it is safe to assume that they were meant for
> "classic Flang" rather than LLVM Flang.

The repository linked in [1] is classic flang.


> `__flang__`, `__flang_major__`, `__flang_minor__` and
> `__flang_patchlevel__` are defined by the driver rather then the
> preprocessor. These pre-definitions are consistent with Clang.

>From the programmer's perspective there is no difference which
component defines a macro. They are expanded the same in CMake's
introspection program.
>From what I have seen it seems to me that there is no version of new
flang/f18 that defined a __FLANG_MAJOR__ etc. preprocessor macro
itself. Is this wrong?

What additional macros does the preprocessor define?

Which macros should CMake use to detect new flang/f18 and distinguish
it from classic flang?

The CMake maintainers are quite responsive and have an interest in
making flang work due their involvement in ECP. I suggest to open a
bug report in the CMake bug tracker to coordinate above questions with
them.

Michael


More information about the flang-dev mailing list