summaryrefslogtreecommitdiffstats
path: root/Modules/FindBLAS.cmake
diff options
context:
space:
mode:
authorMelven Roehrig-Zoellner <Melven.Roehrig-Zoellner@DLR.de>2016-04-03 21:00:44 (GMT)
committerBrad King <brad.king@kitware.com>2016-04-05 13:03:23 (GMT)
commit1694112dfa4e6f5d35ff57c4d565544cf88c0754 (patch)
tree4e1b11773d827034e202831db728bbf9dceaf24c /Modules/FindBLAS.cmake
parente0cc8bf5d7f82cf38ef5e1a643843e244a8f98d6 (diff)
downloadCMake-1694112dfa4e6f5d35ff57c4d565544cf88c0754.zip
CMake-1694112dfa4e6f5d35ff57c4d565544cf88c0754.tar.gz
CMake-1694112dfa4e6f5d35ff57c4d565544cf88c0754.tar.bz2
Find{BLAS,LAPACK}: Fix when used in pure Fortran projects (#16039)
Use `CMAKE_<LANG>_COMPILER_LOADED` to detect enabled languages because `if( _LANGUAGES_ MATCHES C )` is always true on Windows as the RC language is activated automatically and matches C.
Diffstat (limited to 'Modules/FindBLAS.cmake')
-rw-r--r--Modules/FindBLAS.cmake11
1 files changed, 3 insertions, 8 deletions
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 546ada1..728494c 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -59,12 +59,7 @@ set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY})
set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
# Check the language being used
-get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES )
-if( _LANGUAGES_ MATCHES Fortran )
- set( _CHECK_FORTRAN TRUE )
-elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) )
- set( _CHECK_FORTRAN FALSE )
-else()
+if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) )
if(BLAS_FIND_REQUIRED)
message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
else()
@@ -132,7 +127,7 @@ if(_libraries_work)
# Test this combination of libraries.
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread})
# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
- if (_CHECK_FORTRAN)
+ if (CMAKE_Fortran_COMPILER_LOADED)
check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
else()
check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
@@ -483,7 +478,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
if (NOT WIN32)
set(LM "-lm")
endif ()
- if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
+ if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
find_package(Threads)
else()