mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 12:16:40 +08:00
Find{BLAS,LAPACK}: Revert bad refactoring of internal CHECK_*_LIBRARIES
Refactoring in commit 4c74c86f40
(FindBLAS/LAPACK: Add support for the
Fujitsu SSL2 library, 2021-01-27) was done in order to support calling
`find_library` on the dependencies as well as the candidate libraries.
However, it broke a few things:
* Intel MKL's BLAS/LAPACK are no longer found. We specify their
dependencies using `-l...` flags, so we should not try to use
`find_library` for them.
* The dependencies are repeated because we accumulate them in the
`find_library` search loop and then append them at the end too.
Revert the incorrect part of the refactoring. Retain the flags part
needed for the Fujitsu vendor.
Fixes: #22056
This commit is contained in:
@@ -236,23 +236,25 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _add
|
||||
endif()
|
||||
list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
|
||||
|
||||
foreach(_library ${_list} ${_threadlibs})
|
||||
foreach(_library ${_list})
|
||||
if(_library MATCHES "^-Wl,--(start|end)-group$")
|
||||
# Respect linker flags like --start/end-group (required by MKL)
|
||||
set(${LIBRARIES} ${${LIBRARIES}} "${_library}")
|
||||
else()
|
||||
string(REGEX REPLACE "[^A-Za-z0-9]" "_" _lib_var "${_library}")
|
||||
set(_combined_name ${_combined_name}_${_lib_var})
|
||||
set(_combined_name ${_combined_name}_${_library})
|
||||
if(NOT "${_threadlibs}" STREQUAL "")
|
||||
set(_combined_name ${_combined_name}_threadlibs)
|
||||
endif()
|
||||
if(_libraries_work)
|
||||
find_library(${_prefix}_${_lib_var}_LIBRARY
|
||||
find_library(${_prefix}_${_library}_LIBRARY
|
||||
NAMES ${_library}
|
||||
NAMES_PER_DIR
|
||||
PATHS ${_extaddlibdir}
|
||||
PATH_SUFFIXES ${_subdirs}
|
||||
)
|
||||
mark_as_advanced(${_prefix}_${_lib_var}_LIBRARY)
|
||||
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_lib_var}_LIBRARY})
|
||||
set(_libraries_work ${${_prefix}_${_lib_var}_LIBRARY})
|
||||
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
|
||||
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
|
||||
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
@@ -218,23 +218,25 @@ macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _a
|
||||
endif()
|
||||
list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
|
||||
|
||||
foreach(_library ${_list} ${_threadlibs})
|
||||
foreach(_library ${_list})
|
||||
if(_library MATCHES "^-Wl,--(start|end)-group$")
|
||||
# Respect linker flags like --start/end-group (required by MKL)
|
||||
set(${LIBRARIES} ${${LIBRARIES}} "${_library}")
|
||||
else()
|
||||
string(REGEX REPLACE "[^A-Za-z0-9]" "_" _lib_var "${_library}")
|
||||
set(_combined_name ${_combined_name}_${_lib_var})
|
||||
set(_combined_name ${_combined_name}_${_library})
|
||||
if(NOT "${_threadlibs}" STREQUAL "")
|
||||
set(_combined_name ${_combined_name}_threadlibs)
|
||||
endif()
|
||||
if(_libraries_work)
|
||||
find_library(${_prefix}_${_lib_var}_LIBRARY
|
||||
find_library(${_prefix}_${_library}_LIBRARY
|
||||
NAMES ${_library}
|
||||
NAMES_PER_DIR
|
||||
PATHS ${_extaddlibdir}
|
||||
PATH_SUFFIXES ${_subdirs}
|
||||
)
|
||||
mark_as_advanced(${_prefix}_${_lib_var}_LIBRARY)
|
||||
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_lib_var}_LIBRARY})
|
||||
set(_libraries_work ${${_prefix}_${_lib_var}_LIBRARY})
|
||||
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
|
||||
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
|
||||
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
Reference in New Issue
Block a user