Skip to content

Commit

Permalink
FindSCALAPACK: also look for optional libblacs
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Oct 4, 2021
1 parent d6273e1 commit 474648c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmake/Modules/FindSCALAPACK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ else()
PATH_SUFFIXES openmpi/lib mpich/lib
)

# some systems have libblacs as a separate file, instead of being subsumed in libscalapack.
cmake_path(GET SCALAPACK_LIBRARY PARENT_PATH BLACS_ROOT)

find_library(BLACS_LIBRARY
NAMES blacs
NO_DEFAULT_PATH
HINTS ${BLACS_ROOT}
)

endif()

# --- Check that Scalapack links
Expand All @@ -200,12 +209,15 @@ find_package_handle_standard_args(SCALAPACK
if(SCALAPACK_FOUND)
# need if _FOUND guard to allow project to autobuild; can't overwrite imported target even if bad
set(SCALAPACK_LIBRARIES ${SCALAPACK_LIBRARY})
if(BLACS_LIBRARY)
list(APPEND SCALAPACK_LIBRARIES ${BLACS_LIBRARY})
endif()
set(SCALAPACK_INCLUDE_DIRS ${SCALAPACK_INCLUDE_DIR})

if(NOT TARGET SCALAPACK::SCALAPACK)
add_library(SCALAPACK::SCALAPACK INTERFACE IMPORTED)
set_target_properties(SCALAPACK::SCALAPACK PROPERTIES
INTERFACE_LINK_LIBRARIES "${SCALAPACK_LIBRARY}"
INTERFACE_LINK_LIBRARIES "${SCALAPACK_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${SCALAPACK_INCLUDE_DIR}"
)
endif()
Expand Down

0 comments on commit 474648c

Please sign in to comment.