|
@@ -15,11 +15,11 @@ int main() { return 0; }
|
|
|
# List manglings of global symbol names to try.
|
|
# List manglings of global symbol names to try.
|
|
|
set(global_symbols
|
|
set(global_symbols
|
|
|
my_sub # VisualAge
|
|
my_sub # VisualAge
|
|
|
- my_sub_ # GNU, Intel, HP, SunPro, MIPSpro
|
|
|
|
|
|
|
+ my_sub_ # GNU, Intel, HP, SunPro, MIPSpro, PGI
|
|
|
my_sub__ # GNU g77
|
|
my_sub__ # GNU g77
|
|
|
MY_SUB # Intel on Windows
|
|
MY_SUB # Intel on Windows
|
|
|
mysub # VisualAge
|
|
mysub # VisualAge
|
|
|
- mysub_ # GNU, Intel, HP, SunPro, MIPSpro
|
|
|
|
|
|
|
+ mysub_ # GNU, Intel, HP, SunPro, MIPSpro, PGI
|
|
|
MYSUB # Intel on Windows
|
|
MYSUB # Intel on Windows
|
|
|
${FortranCInterface_GLOBAL_SYMBOLS}
|
|
${FortranCInterface_GLOBAL_SYMBOLS}
|
|
|
)
|
|
)
|
|
@@ -71,7 +71,7 @@ if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(PathScale|Cray)$")
|
|
|
# use '.in.' so we cannot provide them anyway.
|
|
# use '.in.' so we cannot provide them anyway.
|
|
|
# - Cray Fortran >= 7.3.2 uses module init symbols but module symbols
|
|
# - Cray Fortran >= 7.3.2 uses module init symbols but module symbols
|
|
|
# use 'mysub$mymodule_' so we cannot provide them anyway.
|
|
# use 'mysub$mymodule_' so we cannot provide them anyway.
|
|
|
- list(APPEND symbol_sources mymodule_.c my_module_.c)
|
|
|
|
|
|
|
+ list(APPEND symbol_sources mymodule_.c my_module_.c MY_MODULE.c MYMODULE.c)
|
|
|
endif()
|
|
endif()
|
|
|
foreach(symbol IN LISTS global_symbols module_symbols)
|
|
foreach(symbol IN LISTS global_symbols module_symbols)
|
|
|
# Skip symbols with '$' if C cannot handle them.
|
|
# Skip symbols with '$' if C cannot handle them.
|
|
@@ -93,11 +93,12 @@ add_library(myfort STATIC mysub.f my_sub.f ${myfort_modules})
|
|
|
|
|
|
|
|
# Provide symbols through C but fall back to Fortran.
|
|
# Provide symbols through C but fall back to Fortran.
|
|
|
add_library(symbols STATIC ${symbol_sources})
|
|
add_library(symbols STATIC ${symbol_sources})
|
|
|
-target_link_libraries(symbols myfort)
|
|
|
|
|
|
|
+target_link_libraries(symbols PUBLIC myfort)
|
|
|
|
|
+
|
|
|
# In case the Fortran compiler produces PIC by default make sure
|
|
# In case the Fortran compiler produces PIC by default make sure
|
|
|
# the C compiler produces PIC even if it is not its default.
|
|
# the C compiler produces PIC even if it is not its default.
|
|
|
set_property(TARGET symbols PROPERTY POSITION_INDEPENDENT_CODE 1)
|
|
set_property(TARGET symbols PROPERTY POSITION_INDEPENDENT_CODE 1)
|
|
|
|
|
|
|
|
# Require symbols through Fortran.
|
|
# Require symbols through Fortran.
|
|
|
add_executable(FortranCInterface main.F call_sub.f ${call_mod})
|
|
add_executable(FortranCInterface main.F call_sub.f ${call_mod})
|
|
|
-target_link_libraries(FortranCInterface symbols)
|
|
|
|
|
|
|
+target_link_libraries(FortranCInterface PUBLIC symbols)
|