2 ## Author: Hank Anderson <hank@statease.com>
3 ## Copyright: (c) Stat-Ease, Inc.
5 ## Last Modified: 12/29/14
6 ## Description: Ported from the OpenBLAS/f_check perl script.
7 ## This is triggered by prebuild.cmake and runs before any of the code is built.
8 ## Appends Fortran information to config.h and Makefile.conf.
10 # CMake vars set by this file:
18 # Defines set by this file:
23 include(CheckLanguage)
24 check_language(Fortran)
25 if(CMAKE_Fortran_COMPILER)
26 enable_language(Fortran)
31 message(STATUS "No Fortran compiler found, can build only BLAS and f2c-converted LAPACK")
34 set (CCOMMON_OPT "${CCOMMON_OPT} -DLAPACK_ILP64")
38 message(STATUS "No Fortran compiler found, can build only BLAS")
44 # run f_check (appends to TARGET files)
46 # TODO: detect whether underscore needed, set #defines and BU appropriately - use try_compile
47 # TODO: set FEXTRALIB flags a la f_check?
50 file(APPEND ${TARGET_CONF_TEMP}
51 "#define BUNDERSCORE _\n"
52 "#define NEEDBUNDERSCORE 1\n"
53 "#define NEED2UNDERSCORES 0\n")
57 #When we only build CBLAS, we set NOFORTRAN=2
60 #set(F_COMPILER GFORTRAN) # CMake handles the fortran compiler
62 file(APPEND ${TARGET_CONF_TEMP}
63 "#define BUNDERSCORE _\n"
64 "#define NEEDBUNDERSCORE 1\n")
67 get_filename_component(F_COMPILER ${CMAKE_Fortran_COMPILER} NAME_WE)
68 string(TOUPPER ${F_COMPILER} F_COMPILER)