summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt13
-rw-r--r--Modules/FortranCInterface/my_module_.c7
-rw-r--r--Modules/FortranCInterface/mymodule_.c7
3 files changed, 12 insertions, 15 deletions
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index 4bcaae9..d35a72c 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -70,6 +70,17 @@ else()
endif()
# Generate C symbol sources.
+set(symbol_sources)
+if(NOT "${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(PathScale|Cray)$")
+ # Provide mymodule_ and my_module_ init symbols because:
+ # - PGI Fortran uses module init symbols
+ # but not for:
+ # - PathScale Fortran uses module init symbols but module symbols
+ # use '.in.' so we cannot provide them anyway.
+ # - Cray Fortran >= 7.3.2 uses module init symbols but module symbols
+ # use 'mysub$mymodule_' so we cannot provide them anyway.
+ list(APPEND symbol_sources mymodule_.c my_module_.c)
+endif()
foreach(symbol IN LISTS global_symbols module_symbols)
# Skip symbols with '$' if C cannot handle them.
if(C_SUPPORTS_DOLLAR OR NOT "${symbol}" MATCHES "\\$")
@@ -89,7 +100,7 @@ endforeach()
add_library(myfort STATIC mysub.f my_sub.f ${myfort_modules})
# Provide symbols through C but fall back to Fortran.
-add_library(symbols STATIC mymodule_.c my_module_.c ${symbol_sources})
+add_library(symbols STATIC ${symbol_sources})
target_link_libraries(symbols myfort)
# Require symbols through Fortran.
diff --git a/Modules/FortranCInterface/my_module_.c b/Modules/FortranCInterface/my_module_.c
index 364b214..6510ae9 100644
--- a/Modules/FortranCInterface/my_module_.c
+++ b/Modules/FortranCInterface/my_module_.c
@@ -1,8 +1 @@
-#if defined(__PATHSCALE__)
-/* PathScale Fortran wants my_module_ when calling any my_module symbol,
- but module symbols use '.in.' so we cannot provide them anyway. */
-void pathscale_my_module_(void) {}
-#else
-/* PGI Fortran wants my_module_ when calling any my_module symbol. */
void my_module_(void) {}
-#endif
diff --git a/Modules/FortranCInterface/mymodule_.c b/Modules/FortranCInterface/mymodule_.c
index b5feda6..5270605 100644
--- a/Modules/FortranCInterface/mymodule_.c
+++ b/Modules/FortranCInterface/mymodule_.c
@@ -1,8 +1 @@
-#if defined(__PATHSCALE__)
-/* PathScale Fortran wants mymodule_ when calling any mymodule symbol,
- but module symbols use '.in.' so we cannot provide them anyway. */
-void pathscale_mymodule_(void) {}
-#else
-/* PGI Fortran wants mymodule_ when calling any mymodule symbol. */
void mymodule_(void) {}
-#endif