mirror of
https://github.com/reactos/CMake.git
synced 2025-02-03 10:31:55 +00:00
80f0201b37
This is a new FortranCInterface.cmake module to replace the previous prototype. All module support files lie in a FortranCInterface directory next to it. This module uses a new approach to detect Fortran symbol mangling. We build a single test project which defines symbols in a Fortran library (one per object-file) and calls them from a Fortran executable. The executable links to a C library which defines symbols encoding all known manglings (one per object-file). The C library falls back to the Fortran library for symbols it cannot provide. Therefore the executable will always link, but prefers the C-implemented symbols when they match. These symbols store string literals of the form INFO:symbol[<name>] so we can parse them out of the executable. This module also provides a simpler interface. It always detects the mangling as soon as it is included. A single macro is provided to generate mangling macros and optionally pre-mangled symbols.
34 lines
1.9 KiB
CMake
34 lines
1.9 KiB
CMake
# Global symbol without underscore.
|
|
set(FortranCInterface_GLOBAL_SYMBOL "@FortranCInterface_GLOBAL_SYMBOL@")
|
|
set(FortranCInterface_GLOBAL_PREFIX "@FortranCInterface_GLOBAL_PREFIX@")
|
|
set(FortranCInterface_GLOBAL_SUFFIX "@FortranCInterface_GLOBAL_SUFFIX@")
|
|
set(FortranCInterface_GLOBAL_CASE "@FortranCInterface_GLOBAL_CASE@")
|
|
set(FortranCInterface_GLOBAL_MACRO "@FortranCInterface_GLOBAL_MACRO@")
|
|
|
|
# Global symbol with underscore.
|
|
set(FortranCInterface_GLOBAL__SYMBOL "@FortranCInterface_GLOBAL__SYMBOL@")
|
|
set(FortranCInterface_GLOBAL__PREFIX "@FortranCInterface_GLOBAL__PREFIX@")
|
|
set(FortranCInterface_GLOBAL__SUFFIX "@FortranCInterface_GLOBAL__SUFFIX@")
|
|
set(FortranCInterface_GLOBAL__CASE "@FortranCInterface_GLOBAL__CASE@")
|
|
set(FortranCInterface_GLOBAL__MACRO "@FortranCInterface_GLOBAL__MACRO@")
|
|
|
|
# Module symbol without underscore.
|
|
set(FortranCInterface_MODULE_SYMBOL "@FortranCInterface_MODULE_SYMBOL@")
|
|
set(FortranCInterface_MODULE_PREFIX "@FortranCInterface_MODULE_PREFIX@")
|
|
set(FortranCInterface_MODULE_MIDDLE "@FortranCInterface_MODULE_MIDDLE@")
|
|
set(FortranCInterface_MODULE_SUFFIX "@FortranCInterface_MODULE_SUFFIX@")
|
|
set(FortranCInterface_MODULE_CASE "@FortranCInterface_MODULE_CASE@")
|
|
set(FortranCInterface_MODULE_MACRO "@FortranCInterface_MODULE_MACRO@")
|
|
|
|
# Module symbol with underscore.
|
|
set(FortranCInterface_MODULE__SYMBOL "@FortranCInterface_MODULE__SYMBOL@")
|
|
set(FortranCInterface_MODULE__PREFIX "@FortranCInterface_MODULE__PREFIX@")
|
|
set(FortranCInterface_MODULE__MIDDLE "@FortranCInterface_MODULE__MIDDLE@")
|
|
set(FortranCInterface_MODULE__SUFFIX "@FortranCInterface_MODULE__SUFFIX@")
|
|
set(FortranCInterface_MODULE__CASE "@FortranCInterface_MODULE__CASE@")
|
|
set(FortranCInterface_MODULE__MACRO "@FortranCInterface_MODULE__MACRO@")
|
|
|
|
# Summarize what was found.
|
|
set(FortranCInterface_GLOBAL_FOUND @FortranCInterface_GLOBAL_FOUND@)
|
|
set(FortranCInterface_MODULE_FOUND @FortranCInterface_MODULE_FOUND@)
|