Make external metis OPTIONAL (fallback available)
Description
The current CMake detection logic results in a configuration error if no external Metis can be found even though a copy of Metis is distributed in external_libs
. Users currently need to set -DCMAKE_REQUIRE_FIND_PACKAGE_METIS=OFF
to enforce using the internal copy. With this change we automatically fall back to the internal copy if no external metis can be found.
@hmenke I have tried a few more things (partly together with @AlexBuccheri) as alternative to this solution but it was too complicated. Namely, we tried to move add_subdirectory(external_libs)
to an earlier position, before include(Octopus_PackageInfo)
, and to set METIS_FOUND=1
to ensure that feature_summary
does not fail. I managed to get this to work by also adding METIS to REQUIRED_PACKAGES_FOUND
and removing it from REQUIRED_PACKAGES_NOT_FOUND
(to which find_package
adds it automatically) but had difficulties with variable scopes (modifying the lists did only work in the top-level CMakeLists.txt
but not external_libs/CMakeLists.txt
despite trying to add it to GLOBAL
scope. If you have suggestions how to solve that I'd be interested in hearing about those.
The current failure showed up in !2508 (merged), in the Fedora full job (where we build with MPI but do not have METIS from Fedora), e.g. https://gitlab.com/octopus-code/octopus/-/jobs/9399815775 (later pipeline runs in the MR set the option to skip searching for external metis).