| 1 |
# @HEADER |
| 2 |
# ***************************************************************************** |
| 3 |
# TriBITS: Tribal Build, Integrate, and Test System |
| 4 |
# |
| 5 |
# Copyright 2013-2016 NTESS and the TriBITS contributors. |
| 6 |
# SPDX-License-Identifier: BSD-3-Clause |
| 7 |
# ***************************************************************************** |
| 8 |
# @HEADER |
| 9 |
|
| 10 |
# This file gets included in the base-level CMakeLists.txt file to define |
| 11 |
# Fortran name mangling. |
| 12 |
|
| 13 |
if (${PROJECT_NAME}_ENABLE_CXX AND ${PROJECT_NAME}_ENABLE_Fortran) |
| 14 |
include(FortranMangling) |
| 15 |
fortran_mangling() |
| 16 |
|
| 17 |
# Verify the selected combination of Fortran and C++ compilers. |
| 18 |
if(NOT ${PROJECT_NAME}_SKIP_FORTRANCINTERFACE_VERIFY_TEST) |
| 19 |
include(FortranCInterface) |
| 20 |
fortrancinterface_verify(CXX) |
| 21 |
endif() |
| 22 |
endif() |
| 23 |
|
| 24 |
if (FC_FUNC_DEFAULT) |
| 25 |
|
| 26 |
set(F77_FUNC_DEFAULT ${FC_FUNC_DEFAULT}) |
| 27 |
set(F77_FUNC__DEFAULT ${FC_FUNC__DEFAULT}) |
| 28 |
# 2008/10/26: rabartl: ToDo: Above, we need to write |
| 29 |
# a different function to find out the right BLAS |
| 30 |
# name mangling automatically. Given what the above |
| 31 |
# fortran_mangling() function does, this should not |
| 32 |
# be too hard. |
| 33 |
|
| 34 |
else() |
| 35 |
|
| 36 |
if(CYGWIN) |
| 37 |
set(F77_FUNC_DEFAULT "(name,NAME) name ## _" ) |
| 38 |
set(F77_FUNC__DEFAULT "(name,NAME) name ## __" ) |
| 39 |
elseif(WIN32) |
| 40 |
set(F77_FUNC_DEFAULT "(name,NAME) name ## _" ) |
| 41 |
set(F77_FUNC__DEFAULT "(name,NAME) NAME") |
| 42 |
elseif(UNIX AND NOT APPLE) |
| 43 |
set(F77_FUNC_DEFAULT "(name,NAME) name ## _" ) |
| 44 |
#set(F77_FUNC__DEFAULT "(name,NAME) name ## __" ) |
| 45 |
set(F77_FUNC__DEFAULT "(name,NAME) name ## _" ) |
| 46 |
elseif(APPLE) |
| 47 |
set(F77_FUNC_DEFAULT "(name,NAME) name ## _" ) |
| 48 |
set(F77_FUNC__DEFAULT "(name,NAME) name ## __" ) |
| 49 |
else() |
| 50 |
message(FATAL_ERROR "Error, could not determine fortran name mangling!") |
| 51 |
endif() |
| 52 |
|
| 53 |
endif() |
| 54 |
|
| 55 |
# Set options so that users can change these! |
| 56 |
|
| 57 |
set(F77_FUNC ${F77_FUNC_DEFAULT} CACHE STRING |
| 58 |
"Name mangling used to call Fortran 77 functions with no underscores in the name") |
| 59 |
set(F77_FUNC_ ${F77_FUNC__DEFAULT} CACHE STRING |
| 60 |
"Name mangling used to call Fortran 77 functions with at least one underscore in the name") |
| 61 |
|
| 62 |
mark_as_advanced(F77_FUNC) |
| 63 |
mark_as_advanced(F77_FUNC_) |