diff --git a/CMakeLists.txt b/CMakeLists.txt index 8092be9d1d..11809a941a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -399,7 +399,10 @@ if(MKLROOT) find_package(MKL REQUIRED) add_definitions(-D__MKL) include_directories(${MKL_INCLUDE} ${MKL_INCLUDE}/fftw) - list(APPEND math_libs MKL::MKL MKL::MKL_SCALAPACK) + list(APPEND math_libs MKL::MKL) + if(TARGET MKL::MKL_SCALAPACK) + list(APPEND math_libs MKL::MKL_SCALAPACK) + endif() if(CMAKE_CXX_COMPILER_ID MATCHES Intel) list(APPEND math_libs ifcore) endif() diff --git a/cmake/FindMKL.cmake b/cmake/FindMKL.cmake index f96287e45d..92e3bc44ad 100644 --- a/cmake/FindMKL.cmake +++ b/cmake/FindMKL.cmake @@ -80,4 +80,9 @@ else() mark_as_advanced(MKL_INCLUDE MKL_INTEL MKL_INTEL_THREAD MKL_CORE) endif() -endif() # MKL::MKL \ No newline at end of file +endif() # MKL::MKL + +# For compatibility with legacy libpaw_interface CMakeLists.txt +if(TARGET MKL::MKL) + add_library(IntelMKL::MKL ALIAS MKL::MKL) +endif() diff --git a/source/module_base/test_parallel/CMakeLists.txt b/source/module_base/test_parallel/CMakeLists.txt index 4bec303a83..0081812973 100644 --- a/source/module_base/test_parallel/CMakeLists.txt +++ b/source/module_base/test_parallel/CMakeLists.txt @@ -1,12 +1,12 @@ AddTest( TARGET base_ParaCommon - LIBS MPI::MPI_CXX + LIBS MPI::MPI_CXX SOURCES parallel_common_test.cpp ../global_variable.cpp ../parallel_common.cpp ) AddTest( TARGET base_ParaGlobal - LIBS MPI::MPI_CXX + LIBS MPI::MPI_CXX SOURCES parallel_global_test.cpp ../global_variable.cpp ../parallel_global.cpp ) @@ -37,7 +37,10 @@ add_test(NAME base_parallel_reduce_test if(ENABLE_LCAO) # figure out the lib that provides BLACS if(MKLROOT) - set(BLACS_LIB IntelMKL::MKL) + list(APPEND BLACS_LIB MKL::MKL) + if(TARGET MKL::MKL_SCALAPACK) + list(APPEND BLACS_LIB MKL::MKL_SCALAPACK) + endif() else() set(BLACS_LIB ScaLAPACK::ScaLAPACK) endif() @@ -53,4 +56,3 @@ if(ENABLE_LCAO) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) endif() -