summaryrefslogtreecommitdiffstats
path: root/Modules/FortranCInterface.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-10-30 20:50:12 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2008-10-30 20:50:12 (GMT)
commit6066a3fca699a8494319439338f6f80078b25414 (patch)
tree7325e35a1f7a956fb829a1725c9adc7a3bcc7d57 /Modules/FortranCInterface.cmake
parent88cf2cb30fd1b71e7ab272e2a3395cc674b5d40d (diff)
downloadCMake-6066a3fca699a8494319439338f6f80078b25414.zip
CMake-6066a3fca699a8494319439338f6f80078b25414.tar.gz
CMake-6066a3fca699a8494319439338f6f80078b25414.tar.bz2
ENH: fix uppercase version so defines are not upper as well
Diffstat (limited to 'Modules/FortranCInterface.cmake')
-rw-r--r--Modules/FortranCInterface.cmake20
1 files changed, 14 insertions, 6 deletions
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
index 0fd9138..c7009a4 100644
--- a/Modules/FortranCInterface.cmake
+++ b/Modules/FortranCInterface.cmake
@@ -84,7 +84,7 @@ function(discover_fortran_module_mangling prefix suffix found)
end subroutine
end module test_interface
")
-
+ set(worked FALSE)
foreach(interface
"test_interface$"
"TEST_INTERFACE_mp_"
@@ -106,6 +106,12 @@ function(discover_fortran_module_mangling prefix suffix found)
return()
endif(worked)
endforeach(interface)
+ if(NOT worked)
+ message(STATUS "Failed to find C binding to Fortran module functions.")
+ set(${prefix} "BROKEN_C_FORTRAN_MODULE_BINDING" PARENT_SCOPE)
+ set(${suffix} "BROKEN_C_FORTRAN_MODULE_BINDING" PARENT_SCOPE)
+ set(${found} FALSE PARENT_SCOPE)
+ endif(NOT worked)
endfunction(discover_fortran_module_mangling)
@@ -189,23 +195,25 @@ function(create_fortran_c_interface NAMESPACE FUNCTIONS HEADER)
"SUFFIX for Fortran to c name mangling")
else(found)
set(FORTRAN_C_MODULE_MANGLING_FOUND FALSE CACHE INTERNAL
- "SUFFIX for Fortran to c name mangling")
+ "Fortran to C Module calling not availible.")
endif(found)
endif(NOT FORTRAN_C_MANGLING_FOUND)
foreach(f ${${FUNCTIONS}})
if(FORTRAN_C_MANGLING_UPPERCASE)
- string(TOUPPER "${f}" f)
+ string(TOUPPER "${f}" fcase)
else()
- string(TOLOWER "${f}" f)
+ string(TOLOWER "${f}" fcase)
endif()
if("${f}" MATCHES ":")
string(REGEX REPLACE "(.*):(.*)" "\\1" module "${f}")
string(REGEX REPLACE "(.*):(.*)" "\\2" function "${f}")
+ string(REGEX REPLACE "(.*):(.*)" "\\1" module_case "${fcase}")
+ string(REGEX REPLACE "(.*):(.*)" "\\2" function_case "${fcase}")
set(HEADER_CONTENT "${HEADER_CONTENT}
-#define ${NAMESPACE}${module}_${function} ${FORTRAN_C_MODULE_PREFIX}${module}${FORTRAN_C_MODULE_SUFFIX}${function}
+#define ${NAMESPACE}${module}_${function} ${FORTRAN_C_MODULE_PREFIX}${module_case}${FORTRAN_C_MODULE_SUFFIX}${function_case}
")
else("${f}" MATCHES ":")
- set(function "${FORTRAN_C_PREFIX}${f}${FORTRAN_C_SUFFIX}")
+ set(function "${FORTRAN_C_PREFIX}${fcase}${FORTRAN_C_SUFFIX}")
if("${f}" MATCHES "_" AND FORTRAN_C_MANGLING_EXTRA_UNDERSCORE)
set(function "${function}_")
endif("${f}" MATCHES "_" AND FORTRAN_C_MANGLING_EXTRA_UNDERSCORE)