From 61bc9e3e5683883047ebda0bc87d576ded75782f Mon Sep 17 00:00:00 2001 From: reyoung Date: Thu, 30 Mar 2017 13:49:15 +0800 Subject: [PATCH] Get Fortran version correctly --- cmake/external/openblas.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/external/openblas.cmake b/cmake/external/openblas.cmake index 62ad2bbc23b..a11d18617bf 100644 --- a/cmake/external/openblas.cmake +++ b/cmake/external/openblas.cmake @@ -30,8 +30,9 @@ IF(NOT ${CBLAS_FOUND}) IF(CMAKE_COMPILER_IS_GNUCC) ENABLE_LANGUAGE(Fortran) if (NOT CMAKE_Fortran_COMPILER_VERSION) - # cmake version is too old, we cannot get fortran version, using CXX version instead. - set(CMAKE_Fortran_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}) + # cmake < 3.4 cannot get CMAKE_Fortran_COMPILER_VERSION directly. + execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -dumpversion + OUTPUT_VARIABLE CMAKE_Fortran_COMPILER_VERSION) endif() string(REGEX MATCHALL "[0-9]+" Fortran_VERSION ${CMAKE_Fortran_COMPILER_VERSION}) list(GET Fortran_VERSION 0 Fortran_MAJOR) -- GitLab