Bladeren bron

ENH: do not error when sunpro or mipspro fortran used

Bill Hoffman 17 jaren geleden
bovenliggende
commit
cecc2ab290
1 gewijzigde bestanden met toevoegingen van 13 en 2 verwijderingen
  1. 13 2
      Tests/Fortran/CMakeLists.txt

+ 13 - 2
Tests/Fortran/CMakeLists.txt

@@ -11,8 +11,19 @@ ADD_EXECUTABLE(testf hello.f)
 # test the C to Fortran interface module
 include(FortranCInterface)
 if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
-  set(srcs foo.f)
-  set(FORTRAN_FUNCTIONS test_mod:sub)
+  if(FORTRAN_C_MODULE_MANGLING_FOUND)
+    set(srcs foo.f)
+    set(FORTRAN_FUNCTIONS test_mod:sub)
+  else(FORTRAN_C_MODULE_MANGLING_FOUND)
+    if(CMAKE_Fortran_COMPILER_ID MATCHES "SunPro|MIPSpro")
+      message("SunPro and MPISpro compilers do not support"
+        " linking Fortran module procedures from C")
+    else()
+      message("This will fail, but let the user see the error")
+      set(srcs foo.f)
+      set(FORTRAN_FUNCTIONS test_mod:sub)
+    endif()
+  endif(FORTRAN_C_MODULE_MANGLING_FOUND)
 endif()
 set(FORTRAN_FUNCTIONS ${FORTRAN_FUNCTIONS} my_sub mysub )
 set(srcs ${srcs} mysub.f foo.c)