You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

f_check.cmake 1.4 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ##
  2. ## Author: Hank Anderson <hank@statease.com>
  3. ## Copyright: (c) Stat-Ease, Inc.
  4. ## Created: 12/29/14
  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.
  9. # CMake vars set by this file:
  10. # F_COMPILER
  11. # FC
  12. # BU
  13. # NOFORTRAN
  14. # NEED2UNDERSCORES
  15. # FEXTRALIB
  16. # Defines set by this file:
  17. # BUNDERSCORE
  18. # NEEDBUNDERSCORE
  19. # NEED2UNDERSCORES
  20. if (NOT NO_LAPACK)
  21. enable_language(Fortran)
  22. else()
  23. include(CMakeForceCompiler)
  24. CMAKE_FORCE_Fortran_COMPILER(gfortran GNU)
  25. endif()
  26. if (NOT ONLY_CBLAS)
  27. # run f_check (appends to TARGET files)
  28. # TODO: detect whether underscore needed, set #defines and BU appropriately - use try_compile
  29. # TODO: set FEXTRALIB flags a la f_check?
  30. set(BU "_")
  31. file(APPEND ${TARGET_CONF_TEMP}
  32. "#define BUNDERSCORE _\n"
  33. "#define NEEDBUNDERSCORE 1\n"
  34. "#define NEED2UNDERSCORES 0\n")
  35. else ()
  36. #When we only build CBLAS, we set NOFORTRAN=2
  37. set(NOFORTRAN 2)
  38. set(NO_FBLAS 1)
  39. #set(F_COMPILER GFORTRAN) # CMake handles the fortran compiler
  40. set(BU "_")
  41. file(APPEND ${TARGET_CONF_TEMP}
  42. "#define BUNDERSCORE _\n"
  43. "#define NEEDBUNDERSCORE 1\n")
  44. endif()
  45. get_filename_component(F_COMPILER ${CMAKE_Fortran_COMPILER} NAME_WE)
  46. string(TOUPPER ${F_COMPILER} F_COMPILER)