瀏覽代碼

Fix Fortran test .def file symbol mangling

Commit 6a61a8a5 (Honor module .def files with MinGW tools, 2011-02-21)
enabled use of .def files with GNU tools on Windows.  Previously the
Fortran tests's world.def file was used only for the Intel Fortran
Compiler on Windows and contained the symbol name mangled for that
compiler.  Instead choose a .def file that names the symbol with proper
mangling for the compiler in use.
Brad King 14 年之前
父節點
當前提交
6c4b249272
共有 3 個文件被更改,包括 14 次插入1 次删除
  1. 12 1
      Tests/Fortran/CMakeLists.txt
  2. 2 0
      Tests/Fortran/world_gnu.def
  3. 0 0
      Tests/Fortran/world_icl.def

+ 12 - 1
Tests/Fortran/CMakeLists.txt

@@ -22,8 +22,19 @@ elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU")
   endif()
   endif()
 endif()
 endif()
 
 
+# Pick a module .def file with the properly mangled symbol name.
+set(world_def "")
+if(WIN32 AND NOT CYGWIN)
+  if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+    set(world_def world_gnu.def)
+  elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel" OR
+      "${CMAKE_GENERATOR}" MATCHES "Visual Studio") # Intel plugin
+    set(world_def world_icl.def)
+  endif()
+endif()
+
 add_library(hello STATIC hello.f)
 add_library(hello STATIC hello.f)
-add_library(world ${_SHARED} world.f world.def)
+add_library(world ${_SHARED} world.f ${world_def})
 add_executable(testf testf.f)
 add_executable(testf testf.f)
 target_link_libraries(testf hello world)
 target_link_libraries(testf hello world)
 
 

+ 2 - 0
Tests/Fortran/world_gnu.def

@@ -0,0 +1,2 @@
+EXPORTS
+        world_

+ 0 - 0
Tests/Fortran/world.def → Tests/Fortran/world_icl.def