Is LLVMFlang (not MSYS2, rather native LLVM) supported in CMake? I hadn’t tried that before.
like https://github.com/llvm/llvm-project/releases/download/llvmorg-23.1.5/LLVM-23.1.5-woa64.msi
On a trivial CMakeLists.txt on configure LLVMFlang isn’t detected, while if I use MSYS2 LLVMFlang as I usually do, MSYS2 LLVMFlang works. But it would be nice if the plain LLVM LLVMFlang worked on Windows.
```cmake
cmake_minimum_required(VERSION 3.20)
project(hi LANGUAGES Fortran)
```
CMake 4.4.4
cmake -Bbuild -G Ninja
– The Fortran compiler identification is LLVMFlang 23.1.5
– Detecting Fortran compiler ABI info
– Detecting Fortran compiler ABI info - failed
– Check for working Fortran compiler: C:/Program Files/LLVM/bin/flang.exe
– Check for working Fortran compiler: C:/Program Files/LLVM/bin/flang.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-4.4/Modules/CMakeTestFortranCompiler.cmake:59 (message):
The Fortran compiler
"C:/Program Files/LLVM/bin/flang.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: '/build/CMakeFiles/CMakeScratch/TryCompile-jonjjo'
Run Build Command(s): /AppData/Local/Microsoft/WinGet/Packages/Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe/ninja.exe -v cmTC_b6b5f
[1/4] C:\WINDOWS\system32\cmd.exe /C ""C:\Program Files\LLVM\bin\flang.exe" -cpp -D_MBCS -fms-runtime-lib=dll_dbg -E \build\CMakeFiles\CMakeScratch\TryCompile-jonjjo\testFortranCompiler.f > CMakeFiles\cmTC_b6b5f.dir\testFortranCompiler.f-pp.f && "C:\Program Files\CMake\bin\cmake.exe" -E cmake_ninja_depends --tdi=CMakeFiles\cmTC_b6b5f.dir\FortranDependInfo.json --lang=Fortran --src=CMakeFiles\cmTC_b6b5f.dir\testFortranCompiler.f-pp.f --out=CMakeFiles\cmTC_b6b5f.dir\testFortranCompiler.f-pp.f --dep=CMakeFiles\cmTC_b6b5f.dir\testFortranCompiler.f-pp.f.d --obj=CMakeFiles\cmTC_b6b5f.dir\testFortranCompiler.f.obj --ddi=CMakeFiles\cmTC_b6b5f.dir\testFortranCompiler.f.obj.ddi --src-orig=\build\CMakeFiles\CMakeScratch\TryCompile-jonjjo\testFortranCompiler.f"
[2/4] "C:\Program Files\CMake\bin\cmake.exe" -E cmake_ninja_dyndep --tdi=CMakeFiles\cmTC_b6b5f.dir\FortranDependInfo.json --lang=Fortran --dd=CMakeFiles\cmTC_b6b5f.dir\Fortran.dd @CMakeFiles\cmTC_b6b5f.dir\Fortran.dd.rsp
[3/4] "C:\Program Files\LLVM\bin\flang.exe" -I\build\CMakeFiles\CMakeScratch\TryCompile-jonjjo -fms-runtime-lib=dll_dbg -ffixed-line-length-72 -o CMakeFiles\cmTC_b6b5f.dir\testFortranCompiler.f.obj -c CMakeFiles\cmTC_b6b5f.dir\testFortranCompiler.f-pp.f
[4/4] C:\WINDOWS\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --msvc-ver=1951 --intdir=CMakeFiles\cmTC_b6b5f.dir --rc=rc --mt="" --manifests -- "C:\Program Files\LLVM\bin\lld-link.exe" /nologo CMakeFiles\cmTC_b6b5f.dir\testFortranCompiler.f.obj /out:cmTC_b6b5f.exe /implib:cmTC_b6b5f.lib /pdb:cmTC_b6b5f.pdb /version:0.0 /debug /INCREMENTAL /subsystem:console -libpath:"C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.51.36231/lib/arm64" -libpath:"C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.51.36231/atlmfc/lib/arm64" -libpath:"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.28000.0/ucrt/arm64" -libpath:"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.28000.0/um/arm64" -libpath:"C:/Program Files/LLVM/lib/clang/23/lib/windows" -libpath:"C:/Program Files/LLVM/lib" -libpath:"C:/Program Files/LLVM/lib/clang/23/lib/aarch64-pc-windows-msvc" && cd ."
FAILED: [code=4294967295] cmTC_b6b5f.exe
C:\WINDOWS\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --msvc-ver=1951 --intdir=CMakeFiles\cmTC_b6b5f.dir --rc=rc --mt="" --manifests -- "C:\Program Files\LLVM\bin\lld-link.exe" /nologo CMakeFiles\cmTC_b6b5f.dir\testFortranCompiler.f.obj /out:cmTC_b6b5f.exe /implib:cmTC_b6b5f.lib /pdb:cmTC_b6b5f.pdb /version:0.0 /debug /INCREMENTAL /subsystem:console -libpath:"C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.51.36231/lib/arm64" -libpath:"C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.51.36231/atlmfc/lib/arm64" -libpath:"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.28000.0/ucrt/arm64" -libpath:"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.28000.0/um/arm64" -libpath:"C:/Program Files/LLVM/lib/clang/23/lib/windows" -libpath:"C:/Program Files/LLVM/lib" -libpath:"C:/Program Files/LLVM/lib/clang/23/lib/aarch64-pc-windows-msvc" && cd ."
RC Pass 1: command "rc /fo CMakeFiles\cmTC_b6b5f.dir/manifest.res CMakeFiles\cmTC_b6b5f.dir/manifest.rc" failed (exit code 0) with the following output:
no such file or directory
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:8 (project)
-- Configuring incomplete, errors occurred!