suitesparse.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index 8e49c19..9ef55e2 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -292,20 +292,19 @@ if (SUITESPARSE)
  6. # built with SuiteSparse support.
  7. # Check for SuiteSparse and dependencies.
  8. - find_package(SuiteSparse 4.5.6 COMPONENTS CHOLMOD SPQR
  9. - OPTIONAL_COMPONENTS Partition)
  10. + find_package(CHOLMOD REQUIRED)
  11. + find_package(SPQR REQUIRED)
  12. + add_library (SuiteSparse::Partition IMPORTED INTERFACE)
  13. + set_property (TARGET SuiteSparse::Partition APPEND PROPERTY INTERFACE_LINK_LIBRARIES SuiteSparse::CHOLMOD)
  14. + set(SuiteSparse_FOUND TRUE)
  15. + set(SuiteSparse_Partition_FOUND TRUE)
  16. + set(SuiteSparse_VERSION ${SUITESPARSE_CONFIG_VERSION})
  17. if (SuiteSparse_FOUND)
  18. set(SuiteSparse_DEPENDENCY "find_dependency(SuiteSparse ${SuiteSparse_VERSION})")
  19. # By default, if all of SuiteSparse's dependencies are found, Ceres is
  20. # built with SuiteSparse support.
  21. message("-- Found SuiteSparse ${SuiteSparse_VERSION}, "
  22. "building with SuiteSparse.")
  23. -
  24. - if (SuiteSparse_NO_CMAKE OR NOT SuiteSparse_DIR)
  25. - install(FILES ${Ceres_SOURCE_DIR}/cmake/FindSuiteSparse.cmake
  26. - ${Ceres_SOURCE_DIR}/cmake/FindMETIS.cmake
  27. - DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR})
  28. - endif (SuiteSparse_NO_CMAKE OR NOT SuiteSparse_DIR)
  29. else (SuiteSparse_FOUND)
  30. # Disable use of SuiteSparse if it cannot be found and continue.
  31. message("-- Did not find all SuiteSparse dependencies, disabling "
  32. diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt
  33. index f9fc241..55a3ceb 100644
  34. --- a/internal/ceres/CMakeLists.txt
  35. +++ b/internal/ceres/CMakeLists.txt
  36. @@ -33,7 +33,9 @@
  37. # Avoid 'xxx.cc has no symbols' warnings from source files which are 'empty'
  38. # when their enclosing #ifdefs are disabled.
  39. find_package(Threads REQUIRED)
  40. -list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES Threads::Threads)
  41. +include(FindPkgConfig)
  42. +pkg_search_module(gklib REQUIRED IMPORTED_TARGET gklib)
  43. +list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES Threads::Threads PkgConfig::gklib)
  44. # Make dependency visible to the parent CMakeLists.txt
  45. set(Threads_DEPENDENCY "find_dependency (Threads)" PARENT_SCOPE)