Merge topic 'fix-FortranCInterface-for-Cray-7.3.2'

d0203fb FortranCInterface: Fix mangling detection with Cray Fortran >= 7.3.2
This commit is contained in:
Brad King 2011-03-31 13:22:38 -04:00 committed by CMake Topic Stage
commit e54e38fadf
3 changed files with 12 additions and 15 deletions

View File

@ -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.

View File

@ -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

View File

@ -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