Add support for Flang on Windows
I'm trying to build Flang on Windows here, https://github.com/xoviat/flang/pull/2.
Flang has 2 components. The frontend flang.exe
which is built first https://github.com/flang-compiler/clang and then the actual flang drivers flang1.exe
, flang2.exe
and the Fortran runtime libraries. Frontend is built successfully.
When building the drivers, I do, cmake -G"NMake Makefiles" -DCMAKE_CXX_COMPILER=clang_cl -DCMAKE_C_COMPILER=clang_cl -DCMAKE_Fortran_COMPILER=flang ..
with Visual Studio 2015 amd64 activated. Note that this Fortran compiler is an incomplete one. Executables flang1.exe
and flang2.exe
are built successfully and then Fortran compiler is almost complete. (There are some linking issues when I try a hello-world.f90 program, but that's probably not related to the problem below)
When creating flang_static.lib
which has Fortran sources, Fortran sources are compiled correctly, but when linking the object files together it fails in the Building fortran static library flang_static.lib
step. This is because this tries to link using (contents of "link.txt" below)
"" qc ..\..\lib\flang_static.lib /machine:x64 CMakeFiles\flang_static.dir\abort3f.c.obj ... "" ..\..\lib\flang_static.lib
This is not using Microsoft's link.exe program and qc
seems to be coming from https://github.com/Kitware/CMake/blob/b8fc447c1df34eeca1d66acd0e17ca743256d6c2/Modules/CMakeCInformation.cmake#L179 where CMAKE_AR
is the first ""
in the command above.
I tried using CMake-3.10.0-rc3
and CMake-3.9.3
and there's no difference.
Please let me know if you need any more details.