[CMake] CheckFortranFunctionExists for dummies

luxInteg lux-integ at btconnect.com
Fri Dec 17 21:30:53 EST 2010


Greetings

I want to learn to use CheckFortranFunctionExists.cmake.  I am assuming it 
works as CheckFunctionExist.cmake.

The cmake documentation gave the following description:-
-------------------------------------------------------------
CheckFortranFunctionExists: macro which checks if the Fortran function exists
 
CHECK_FORTRAN_FUNCTION_EXISTS(FUNCTION VARIABLE)
  FUNCTION - the name of the Fortran function
  VARIABLE - variable to store the result

The following variables may be set before calling this macro to modify the way 
the check is run:
  CMAKE_REQUIRED_LIBRARIES = list of libraries to link
--------------------------------------------------------------

The only example usage I have found is in FindBLAS.cmake  and therein   the 
examples are far from clear.      I   thus have not been able to find any  
straightforwad  examples of  ${FUNCTIONS} (eg XXX)  and 
{VARIABLES}  (eg -DHAVE_XXXX???  to substitute in the above ).  

I have  below the  excerpt from an  auto-tools spew which I would like to use 
as a trainer   for using  CheckFortranFunctionExists.cmake:-

-----------------------------
checking if BLAS, ATLAS or MKL is available... 
checking how to get verbose linking output from gfortran... -v
checking for Fortran 77 libraries of gfortran...  -L/usr/local/atlas/lib -
L/usr/local/numerics6/static_lib -L/usr/local/numerics6/lib -
L/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.2 -L/usr/lib/gcc/x86_64-unknown-
linux-gnu/4.4.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib -
L/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../.. -lpthread -ldl -lcurses 
-lgfortranbegin -lgfortran -lm
checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... lower case, underscore, no 
extra underscore
checking for sgemm_... no
checking for ATL_xerbla in -latlas... yes
checking for sgemm_ in -lf77blas... yes
checking for cblas_dgemm in -lcblas... yes
Atlas found
-------

checking whether LSAME is called correctly from Fortran... yes
checking whether ISAMAX is called correctly from Fortran... yes
checking whether SDOT is called correctly from Fortran... yes
checking whether DDOT is called correctly from Fortran... yes
checking whether CDOTU is called correctly from Fortran... yes
checking whether ZDOTU is called correctly from Fortran... yes
checking whether the integer size is correct... yes
------------------------

but I do not know how to   translate stuff
----------referred to for example in this line ---:
checking for Fortran 77 name-mangling scheme... lower case, underscore, no 
extra underscore 

----------or what is refered to  in  this line----- :
checking whether DDOT is called correctly from Fortran... yes





into  syntax to feed into  CHECK_FORTRAN_FUNCTION_EXISTS()


advice would be appreciated
luxInteg


More information about the CMake mailing list