ParMETIS icon indicating copy to clipboard operation
ParMETIS copied to clipboard

Adding Metis and GKlib as ExternalProject in CMake

Open gnikit opened this issue 3 years ago • 0 comments

I was wondering if it would be more convenient adding Metis and GKlib as external projects to ParMetis, or adding GKlib as an external project to Metis and Metis to ParMetis, thus eliminating the need to be built seperately.

Something like this should work (snippet is for building Zoltan, not Metis but you get the idea).

ExternalProject_Add(libmetis
  PREFIX Zoltan
  GIT_REPOSITORY https://github.com/
  GIT_TAG origin/main
  CONFIGURE_COMMAND ${ZOLTAN_CONFIGURE}
  BUILD_COMMAND make everything
  BUILD_BYPRODUCTS <BINARY_DIR>/src/libzoltan.a
  INSTALL_COMMAND ""
  LOG_DOWNLOAD ON
  LOG_CONFIGURE ON
  LOG_BUILD ON
)
ExternalProject_Get_property(libzoltan BINARY_DIR)
set(Zoltan_BINARY_DIR ${BINARY_DIR})
add_library(Zoltan STATIC IMPORTED)
add_dependencies(Zoltan libzoltan)
set_target_properties(Zoltan
  PROPERTIES IMPORTED_LOCATION ${Zoltan_BINARY_DIR}/src/libzoltan.a
)

Docs for ExternalProject_Add.

This would also, mostly, eliminate the need to carry the Makefile which produces the build directory.

Let me know what you think.

gnikit avatar Jul 06 '22 13:07 gnikit