From 38cc0f1cbbe788e994973b71c8d3c5e08d8ba5e3 Mon Sep 17 00:00:00 2001 From: jinzx10 Date: Sun, 9 Jun 2024 20:45:16 +0800 Subject: [PATCH] fix blacs lib in UT (#4338) --- .../module_base/test_parallel/CMakeLists.txt | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/source/module_base/test_parallel/CMakeLists.txt b/source/module_base/test_parallel/CMakeLists.txt index 9e05105183..4bec303a83 100644 --- a/source/module_base/test_parallel/CMakeLists.txt +++ b/source/module_base/test_parallel/CMakeLists.txt @@ -35,15 +35,22 @@ add_test(NAME base_parallel_reduce_test ) if(ENABLE_LCAO) -AddTest( - TARGET blacs_connector - LIBS MPI::MPI_CXX ScaLAPACK::ScaLAPACK - SOURCES blacs_connector_test.cpp -) -install(FILES blacs_connector_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -add_test(NAME blacs_connector_test - COMMAND ${BASH} blacs_connector_test.sh - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) + # figure out the lib that provides BLACS + if(MKLROOT) + set(BLACS_LIB IntelMKL::MKL) + else() + set(BLACS_LIB ScaLAPACK::ScaLAPACK) + endif() + + AddTest( + TARGET blacs_connector + LIBS MPI::MPI_CXX ${BLACS_LIB} + SOURCES blacs_connector_test.cpp + ) + install(FILES blacs_connector_test.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + add_test(NAME blacs_connector_test + COMMAND ${BASH} blacs_connector_test.sh + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) endif()