diff options
author | Brad King <brad.king@kitware.com> | 2021-04-14 18:14:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-04-14 18:57:03 (GMT) |
commit | a57c4eef76d623078fe7ff718951a71da000a499 (patch) | |
tree | 4acd0a98b7f477129c393f4389d5265df8c5f0ac /Modules/FindBLAS.cmake | |
parent | a5a6ac7033f107626e76eb09ccd86bf49ccdbecd (diff) | |
download | CMake-a57c4eef76d623078fe7ff718951a71da000a499.zip CMake-a57c4eef76d623078fe7ff718951a71da000a499.tar.gz CMake-a57c4eef76d623078fe7ff718951a71da000a499.tar.bz2 |
Find{BLAS,LAPACK}: Convert internal CHECK_*_LIBRARIES to functions
Diffstat (limited to 'Modules/FindBLAS.cmake')
-rw-r--r-- | Modules/FindBLAS.cmake | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index a61d71f..0ad5d8c 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -208,22 +208,16 @@ endif() # TODO: move this stuff to a separate module -macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir _subdirs) - # This macro checks for the existence of the combination of fortran libraries - # given by _list. If the combination is found, this macro checks (using the - # Check_Fortran_Function_Exists macro) whether can link against that library - # combination using the name of a routine given by _name using the linker - # flags given by _flags. If the combination of libraries is found and passes - # the link test, LIBRARIES is set to the list of complete library paths that - # have been found. Otherwise, LIBRARIES is set to FALSE. - - # N.B. _prefix is the prefix applied to the names of all cached variables that - # are generated internally and marked advanced by this macro. - # _addlibdir is a list of additional search paths. _subdirs is a list of path - # suffixes to be used by find_library(). +function(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir _subdirs) + # This function checks for the existence of the combination of libraries + # given by _list. If the combination is found, this checks whether can link + # against that library combination using the name of a routine given by _name + # using the linker flags given by _flags. If the combination of libraries is + # found and passes the link test, ${LIBRARIES} is set to the list of complete + # library paths that have been found. Otherwise, ${LIBRARIES} is set to FALSE. set(_libraries_work TRUE) - set(${LIBRARIES}) + set(_libraries) set(_combined_name) set(_extaddlibdir "${_addlibdir}") @@ -239,7 +233,7 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir foreach(_library ${_list}) if(_library MATCHES "^-Wl,--(start|end)-group$") # Respect linker flags like --start/end-group (required by MKL) - list(APPEND ${LIBRARIES} "${_library}") + list(APPEND _libraries "${_library}") else() set(_combined_name ${_combined_name}_${_library}) if(NOT "${_deps}" STREQUAL "") @@ -253,7 +247,7 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir PATH_SUFFIXES ${_subdirs} ) mark_as_advanced(${_prefix}_${_library}_LIBRARY) - list(APPEND ${LIBRARIES} ${${_prefix}_${_library}_LIBRARY}) + list(APPEND _libraries ${${_prefix}_${_library}_LIBRARY}) set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) endif() endif() @@ -265,7 +259,7 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir endforeach() if(_libraries_work) # Test this combination of libraries. - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_deps}) + set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${_libraries} ${_deps}) if(CMAKE_Fortran_COMPILER_LOADED) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else() @@ -277,14 +271,15 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir if(_libraries_work) if("${_list}" STREQUAL "") - set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES") + set(_libraries "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES") else() - list(APPEND ${LIBRARIES} ${_deps}) + list(APPEND _libraries ${_deps}) endif() else() - set(${LIBRARIES} FALSE) + set(_libraries FALSE) endif() -endmacro() + set(${LIBRARIES} "${_libraries}" PARENT_SCOPE) +endfunction() set(BLAS_LINKER_FLAGS) set(BLAS_LIBRARIES) |