summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEisuke Kawashima <15070-e-kwsm@users.noreply.gitlab.kitware.com>2022-07-06 07:53:47 +0900
committerBrad King <brad.king@kitware.com>2022-07-06 13:58:47 -0400
commit28d52a43fc1f69cfff9f87d167b897f13ec60fe2 (patch)
tree985c7661aa3def27169858b50a7ae5b399b992aa
parent7b43112beeacb5ee89efcf819fb49a1d0679922d (diff)
downloadcmake-28d52a43fc1f69cfff9f87d167b897f13ec60fe2.tar.gz
FindLAPACK: Add '-fortranlibs' flag only with NVHPC/PGI compilers
Since commit 2c9e623e31 (Find{BLAS,LAPACK}: Add support for the NVHPC LAPACK library, 2021-05-05, v3.21.0-rc1~192^2) we try the `-fortranlibs` option as a dependency of the NVHPC LAPACK. That flag is specific to the NVHPC/PGI compilers, so use it conditionally with them. Without this modification, CMake fails to find LAPACK if - compiler ID is GNU - `BLA_STATIC` is `ON` - `BLA_VENDOR` is not defined or set to `All` Fixes: #23705, #22878
-rw-r--r--Modules/FindLAPACK.cmake9
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 5540965e53..91086a3e82 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -663,6 +663,10 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
elseif(_lapack_sizeof_integer EQUAL 4)
string(APPEND _lapack_nvhpc_lib "_lp64")
endif()
+ set(_lapack_nvhpc_flags)
+ if(";${CMAKE_C_COMPILER_ID};${CMAKE_CXX_COMPILER_ID};${CMAKE_Fortran_COMPILER_ID};" MATCHES ";(NVHPC|PGI);")
+ set(_lapack_nvhpc_flags "-fortranlibs")
+ endif()
check_lapack_libraries(
LAPACK_LIBRARIES
@@ -670,7 +674,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
cheev
""
"${_lapack_nvhpc_lib}"
- "-fortranlibs"
+ "${_lapack_nvhpc_flags}"
""
""
"${BLAS_LIBRARIES}"
@@ -688,7 +692,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
cheev
""
"${_lapack_nvhpc_lib}"
- "-fortranlibs"
+ "${_lapack_nvhpc_flags}"
""
""
"${BLAS_LIBRARIES}"
@@ -696,6 +700,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
endif()
unset(_lapack_nvhpc_lib)
+ unset(_lapack_nvhpc_flags)
endif()
# Generic LAPACK library?