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:
24 # had to do this for MSVC, else CMake automatically assumes I have ifort... -hpa
25 include(CMakeForceCompiler)
26 CMAKE_FORCE_Fortran_COMPILER(gfortran GNU)
30 enable_language(Fortran)
32 include(CMakeForceCompiler)
33 CMAKE_FORCE_Fortran_COMPILER(gfortran GNU)
37 # N.B. f_check is not cross-platform, so instead try to use CMake variables
38 # run f_check (appends to TARGET files)
39 # message(STATUS "Running f_check...")
40 # execute_process(COMMAND perl f_check ${TARGET_MAKE} ${TARGET_CONF} ${CMAKE_Fortran_COMPILER}
41 # WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
43 # TODO: detect whether underscore needed, set #defines and BU appropriately - use try_compile
44 # TODO: set FEXTRALIB flags a la f_check?
47 file(APPEND ${TARGET_CONF}
48 "#define BUNDERSCORE _\n"
49 "#define NEEDBUNDERSCORE 1\n"
50 "#define NEED2UNDERSCORES 0\n")
54 #When we only build CBLAS, we set NOFORTRAN=2
57 #set(F_COMPILER GFORTRAN) # CMake handles the fortran compiler
59 file(APPEND ${TARGET_CONF}
60 "#define BUNDERSCORE _\n"
61 "#define NEEDBUNDERSCORE 1\n")
64 get_filename_component(F_COMPILER ${CMAKE_Fortran_COMPILER} NAME_WE)
65 string(TOUPPER ${F_COMPILER} F_COMPILER)