diff --git a/CMakeLists.txt b/CMakeLists.txt index c2b0a09..08bd944 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,7 @@ endif() # For building the CHOLMOD based solvers option(G2O_USE_CHOLMOD "Build g2o with CHOLMOD support" ON) -find_package(SuiteSparse) +find_package(SuiteSparse_CHOLMOD NAMES CHOLMOD CONFIG REQUIRED) if (G2O_USE_CHOLMOD AND SuiteSparse_CHOLMOD_FOUND) message(STATUS "Enable support for Cholmod") set(CHOLMOD_FOUND TRUE) @@ -128,7 +128,8 @@ endif() # For building the CSparse based solvers. Note this depends on an LGPL library. option(G2O_USE_CSPARSE "Build g2o with CSParse support" ON) -find_package(CSparse) +find_package(CSPARSE NAMES CXSparse REQUIRED) +set(CSPARSE_LIBRARY SuiteSparse::CXSparse) if (${G2O_USE_CSPARSE} AND ${CSPARSE_FOUND} AND ${G2O_USE_LGPL_LIBS}) message(STATUS "Enable support for CSparse") else() diff --git a/cmake_modules/Config.cmake.in b/cmake_modules/Config.cmake.in index efeb3bd..f8ab1ad 100644 --- a/cmake_modules/Config.cmake.in +++ b/cmake_modules/Config.cmake.in @@ -1,4 +1,6 @@ include(CMakeFindDependencyMacro) +find_dependency(CHOLMOD CONFIG) +find_dependency(CXSparse CONFIG) find_dependency(Eigen3)