An update will be applied January 25th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit 2e2db28e authored by Brad King's avatar Brad King
Browse files

Find{BLAS,LAPACK}: Simplify check_function_exists state maintenance

Now that `CHECK_{BLAS,LAPACK}_LIBRARIES` are functions, we can set
`CMAKE_REQUIRED_QUIET` locally without affecting the global state.
parent 02fbe408
...@@ -176,10 +176,7 @@ if(CMAKE_Fortran_COMPILER_LOADED) ...@@ -176,10 +176,7 @@ if(CMAKE_Fortran_COMPILER_LOADED)
else() else()
include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
endif() endif()
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY})
if(BLA_PREFER_PKGCONFIG) if(BLA_PREFER_PKGCONFIG)
find_package(PkgConfig) find_package(PkgConfig)
...@@ -261,6 +258,7 @@ function(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlib ...@@ -261,6 +258,7 @@ function(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlib
if(_libraries_work) if(_libraries_work)
# Test this combination of libraries. # Test this combination of libraries.
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${_libraries} ${_deps}) set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${_libraries} ${_deps})
set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY})
if(CMAKE_Fortran_COMPILER_LOADED) if(CMAKE_Fortran_COMPILER_LOADED)
check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
else() else()
...@@ -1086,5 +1084,4 @@ if(NOT BLA_F95) ...@@ -1086,5 +1084,4 @@ if(NOT BLA_F95)
endif() endif()
_add_blas_target() _add_blas_target()
cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
...@@ -127,7 +127,6 @@ if(CMAKE_Fortran_COMPILER_LOADED) ...@@ -127,7 +127,6 @@ if(CMAKE_Fortran_COMPILER_LOADED)
else() else()
include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
endif() endif()
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
function(_add_lapack_target) function(_add_lapack_target)
...@@ -164,9 +163,6 @@ function(_add_lapack_target) ...@@ -164,9 +163,6 @@ function(_add_lapack_target)
endfunction() endfunction()
macro(_lapack_find_library_setup) macro(_lapack_find_library_setup)
cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY})
set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(BLA_STATIC) if(BLA_STATIC)
if(WIN32) if(WIN32)
...@@ -185,7 +181,6 @@ endmacro() ...@@ -185,7 +181,6 @@ endmacro()
macro(_lapack_find_library_teardown) macro(_lapack_find_library_teardown)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
unset(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) unset(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
cmake_pop_check_state()
endmacro() endmacro()
# TODO: move this stuff to a separate module # TODO: move this stuff to a separate module
...@@ -243,6 +238,7 @@ function(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addl ...@@ -243,6 +238,7 @@ function(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addl
if(_libraries_work) if(_libraries_work)
# Test this combination of libraries. # Test this combination of libraries.
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${_libraries} ${_blas} ${_deps}) set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${_libraries} ${_blas} ${_deps})
set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY})
if(CMAKE_Fortran_COMPILER_LOADED) if(CMAKE_Fortran_COMPILER_LOADED)
check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
else() else()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment