You remotivated me to retry flang after so many fail attempts to get it actually working on a conda env on windows. While I couldn’t build stdlib with it because there are some missing features in the compiler, it did “work” in the sense of installing and building and reporting warnings and errors.
I’ll leave a few tips of what I had to do for reference:
Isolate the LLVM environment
conda create -n llvm
Install the required compiler, libraries and runtimes
conda activate llvm
conda install conda-forge::flang llvm-openmp flang-rt_win-64 vs2022_win-64
For CMake, I hit a very tiny but annoying issue that took me some iterations to find, one has to declare clang-cl (not clang) as the C compiler if building outside a unix-like terminal for a MVSC-like behavior instead of GNU:
-DCMAKE_Fortran_COMPILER=flang
-DCMAKE_C_COMPILER=clang-cl