Hey all,

i'm encountering link errors on C-Fortran interface verification on MSYS2 (fully updated) / MinGW (x86_64-4.9.2-posix-seh-rt_v4-rev2) / CMake 3.3.0.
Here's a minimal example:

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

project(C_Fortran_Mingw VERSION 1.0 LANGUAGES C Fortran)

include(FortranCInterface)

FortranCInterface_VERIFY()


this fails with link errors

D:/MSYS2_64/mingw64/bin/gcc.exe  -O3 -DNDEBUG   -Wl,--whole-archive 
CMakeFiles/VerifyFortranC.dir/objects.a -Wl,--no-whole-archive  -o 
VerifyFortranC.exe -Wl,--out-implib,libVerifyFortranC.dll.a 
-Wl,--major-image-version,0,--minor-image-version,0 
@CMakeFiles/VerifyFortranC.dir/linklibs.rsp

libVerifyFortran.a(VerifyFortran.f.obj):VerifyFortran.f:(.text+0x35): undefined 
reference to `_gfortran_st_write'

libVerifyFortran.a(VerifyFortran.f.obj):VerifyFortran.f:(.text+0x4a): undefined 
reference to `_gfortran_transfer_character_write'

libVerifyFortran.a(VerifyFortran.f.obj):VerifyFortran.f:(.text+0x52): undefined 
reference to `_gfortran_st_write_done'


after checking, the @CMakeFiles/VerifyFortranC.dir/linklibs.rsp does not contain the "-lgfortran" library include, hence the fuss. however, while that might fix the issue, i've found no way to tell the FortranCInterface scripts to add that, and following Brad's argumentation in http://cmake.3232098.n2.nabble.com/mixing-c-fortran-missing-gfortran-sometimes-td5563701.html, CMake should pick those things up automatically.

so am i missing something obvious here or is this still an (mingw-only) issue? to be clear, i can just skip the verification tests and everything works, but i'd like to think that if that is the case the

FortranCInterface_VERIFY()

should work as well.

thanks!
Daniel

--
Dr. Daniel Wirtz
Dipl. Math. Dipl. Inf.
SRC SimTech
Pfaffenwaldring 5a, D-70569 Stuttgart
+49 (711) 685-60044

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to