[PATCH] D122008: [flang][driver] Add support for generating executables

H. Vetinari via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 13 15:28:16 PDT 2022


h-vetinari added a comment.

Speaking as a relative outside (but who's been waiting for flang in LLVM since well before it joined the monorepo), I'd much prefer code-generation-with-rough-edges in LLVM 15 (to start testing and raising eventual bugs), rather than a more polished flang (realistically still with bugs that need to be shaken out) in LLVM 16.

I can understand why Option 2 would be more attractive for those not wanting to attract too much attention yet (and shouldn't be a blocker for my purposes), hence I looked a bit into:

In D122008#3448529 <https://reviews.llvm.org/D122008#3448529>, @awarzynski wrote:

> I investigated a bit and discovered that internally CMake calls try_compile <https://gitlab.kitware.com/cmake/cmake/blob/1c12694124aedc0f7cf5a98e635e27d4c338fce0/Modules/CMakeTestFortranCompiler.cmake#L49-51> (CMake docs <https://cmake.org/cmake/help/latest/command/try_compile.html>). I don't see  any way to pass custom compiler options there (i.e. `try_compile` expects `flang-new file.f90` to just work). This makes me rather hesitant to pursue Option 2 at all.

I'd be more than a little surprised that there's no way to do this. Have you tried CMAKE_Fortran_FLAGS <https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html>? AFAICT, the environment variables should be respected. After a bit of googling, a very similar issue came up <https://stackoverflow.com/questions/44284275/passing-compiler-options-cmake>  already at least 15 years ago, and here's a recent SO answer <https://stackoverflow.com/questions/44284275/passing-compiler-options-cmake> about it. Worst case, one can always ask on the CMake discourse <https://discourse.cmake.org/>, people are very helpful and responsive in my experience.

Given that Option 2 might be the path of highest consensus, I think it would be worth a bit more investigation if it's really impossible.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122008/new/

https://reviews.llvm.org/D122008



More information about the cfe-commits mailing list