Do not export the SuiteSparse Partition target The Partition target merely signals that CHOLMOD was compiled with METIS and adds nothing beyond CHOLMOD and METIS. Exporting it as a dependency of Ceres forced consumers to repeat the partitioning check in their own environment. If the check failed there, the Ceres target referred to a missing target and CMake generation failed. Link CHOLMOD and METIS directly and use the Partition component only to enable CHOLMOD partitioning. Fixes #1172 Change-Id: If9ea17dd462f3712e92039c0c0217545ba2ea57e
diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt index e541e76..9a20047 100644 --- a/internal/ceres/CMakeLists.txt +++ b/internal/ceres/CMakeLists.txt
@@ -100,10 +100,9 @@ add_definitions(-DCERES_SUITESPARSE_VERSION="${SuiteSparse_VERSION}") list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES SuiteSparse::CHOLMOD SuiteSparse::SPQR) - - if (SuiteSparse_Partition_FOUND) - list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES SuiteSparse::Partition) - endif (SuiteSparse_Partition_FOUND) + # SuiteSparse::Partition only signals METIS support in CHOLMOD. Linking it + # would make consumers depend on the partitioning check succeeding in their + # environment. CHOLMOD and METIS are linked explicitly instead. endif (_Ceres_FEATURE_SUITESPARSE) if (_Ceres_FEATURE_CHOLMOD_PARTITION OR _Ceres_FEATURE_EIGEN_METIS)