[llvm] [runtimes][cmake] Probe Fortran intrinsic modules for the target triple (PR #211137)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 07:08:19 PDT 2026


Meinersbur wrote:

CMake 3.23 and below: Missing `--target=` for ` execute_process(COMMAND ${CMAKE_Fortran_COMPILER} ...`: Definitely a bug.

CMake between 3.34 and 3.27: CMake does not set `CMAKE_Fortran_COMPILE_OPTIONS_TARGET` so `config-Fortran.cmake` sets it manually. However, I noticed that when set manually, CMake may not pass it to `try_compile` which is what I believe you see here. Probably a scoping issue in CMake. `execute_process` was originally a workaround for CMake < 3.24 but should work with any version of CMake.

I would like to eventually clean up the workarounds for older CMake version once 3.31 becomes the minimum. 

I think the `try_compile` changes are not needed as CMake automatically passes the flang (or it would not work at all when cross-compiling, and should only be needed for gfortran where CMAKE_Fortran_COMPILE_OPTIONS_TARGET is empty anyway. Can you confirm? If so, could you remove that part?

https://github.com/llvm/llvm-project/pull/211137


More information about the llvm-commits mailing list