Merge pull request #3516 from mmuetzel/no-fortran

cmake: Check if Fortran compiler is usable before enabling it.
This commit is contained in:
Martin Kroeker 2022-01-25 20:57:38 +01:00 committed by GitHub
commit b0d39349f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 11 deletions

View File

@ -20,19 +20,16 @@
# NEEDBUNDERSCORE # NEEDBUNDERSCORE
# NEED2UNDERSCORES # NEED2UNDERSCORES
if (NOT NO_LAPACK) include(CheckLanguage)
include(CheckLanguage) check_language(Fortran)
check_language(Fortran) if(CMAKE_Fortran_COMPILER)
if(CMAKE_Fortran_COMPILER) enable_language(Fortran)
enable_language(Fortran) else()
else() if (NOT NO_LAPACK)
message(STATUS "No Fortran compiler found, can build only BLAS but not LAPACK") message(STATUS "No Fortran compiler found, can build only BLAS but not LAPACK")
endif()
set (NOFORTRAN 1) set (NOFORTRAN 1)
set (NO_LAPACK 1) set (NO_LAPACK 1)
endif()
else()
include(CMakeForceCompiler)
CMAKE_FORCE_Fortran_COMPILER(gfortran GNU)
endif() endif()
if (NOT ONLY_CBLAS) if (NOT ONLY_CBLAS)