cmake: Check for Fortran compiler early on

This commit is contained in:
Markus Mützel 2023-08-05 13:32:20 +02:00
parent 138ed79fe7
commit f047ca3111
2 changed files with 12 additions and 6 deletions

View File

@ -93,6 +93,17 @@ endif()
message(WARNING "CMake support is experimental. It does not yet support all build options and may not produce the same Makefiles that OpenBLAS ships with.") message(WARNING "CMake support is experimental. It does not yet support all build options and may not produce the same Makefiles that OpenBLAS ships with.")
if(NOT NOFORTRAN)
# Check for working Fortran compiler
include(CheckLanguage)
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
enable_language(Fortran)
else()
set(NOFORTRAN 1)
endif()
endif()
include("${PROJECT_SOURCE_DIR}/cmake/utils.cmake") include("${PROJECT_SOURCE_DIR}/cmake/utils.cmake")
include("${PROJECT_SOURCE_DIR}/cmake/system.cmake") include("${PROJECT_SOURCE_DIR}/cmake/system.cmake")

View File

@ -20,12 +20,7 @@
# NEEDBUNDERSCORE # NEEDBUNDERSCORE
# NEED2UNDERSCORES # NEED2UNDERSCORES
include(CheckLanguage) if(NOT CMAKE_Fortran_COMPILER)
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
enable_language(Fortran)
else()
set (NOFORTRAN 1)
if (NOT NO_LAPACK) if (NOT NO_LAPACK)
if (NOT XXXXX) if (NOT XXXXX)
message(STATUS "No Fortran compiler found, can build only BLAS and f2c-converted LAPACK") message(STATUS "No Fortran compiler found, can build only BLAS and f2c-converted LAPACK")