[all-commits] [llvm/llvm-project] e5d74b: [flang-rt][cmake] Fix Windows build with CMAKE_For...

Michael Kruse via All-commits all-commits at lists.llvm.org
Wed Jun 10 07:17:37 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e5d74b05e324953397fcaab5df3c50f330d85875
      https://github.com/llvm/llvm-project/commit/e5d74b05e324953397fcaab5df3c50f330d85875
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2026-06-10 (Wed, 10 Jun 2026)

  Changed paths:
    M runtimes/cmake/config-Fortran.cmake

  Log Message:
  -----------
  [flang-rt][cmake] Fix Windows build with CMAKE_Fortran_SIMULATE_ID (#202981)

The PR #198205 sets CMAKE_Fortran_SIMULATE_ID to "GNU", since Flang has
no alternative driver such as an equivalent to clang-cl. But it breaks
the Windows build with
```
LINK : warning LNK4044: unrecognized option '/lpsapi'; ignored
LINK : warning LNK4044: unrecognized option '/lshell32'; ignored
LINK : warning LNK4044: unrecognized option '/lole32'; ignored
LINK : warning LNK4044: unrecognized option '/luuid'; ignored
LINK : warning LNK4044: unrecognized option '/ladvapi32'; ignored
LINK : warning LNK4044: unrecognized option '/lws2_32'; ignored
LINK : warning LNK4044: unrecognized option '/lntdll'; ignored
LINK : warning LNK4044: unrecognized option '/ldelayimp'; ignored
```

The reason is interesting. With CMAKE_Fortran_SIMULATE_ID=GNU, CMake
will include the Windows-GNU.cmake
platform file. That file overwrites CMAKE_LINK_LIBRARY_FLAG with
`-l` which is GNU convention for the linker flag. But since
CMAKE_LINK_LIBRARY_FLAG is global (in contrast to a per-language
setting), it changes the flags for link.exe/lld-link.exe even when
compiling C/C++ applications. CMake internally converts `-l` to `/l` for
convenience.

Set CMAKE_Fortran_SIMULATE_ID to the same as CMAKE_CXX_SIMULATE_ID as
originally proposed in #198205. While flang.exe is a GNU-style driver,
setting it to "MSVC" still works, probably because there is no
alternative set of flags for Flang. Also define some additional
variables that CMake stores in `CMakeFortranCompiler.cmake` in the build
directory when CMake is allowed to introspect the Flang driver itself.

Should fix the buildbots
flang-arm64-windows-msvc-testsuite,
flang-arm64-windows-msvc,
flang-x86_64-windows



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list