Skip to content

Commit

Permalink
Merge pull request jrl-umi3218#664 from jcarpent/topic/cholmod
Browse files Browse the repository at this point in the history
Fix finder for CholMod
  • Loading branch information
jcarpent authored Feb 11, 2024
2 parents dd568f7 + 36f9aff commit acef690
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions find-external/CHOLMOD/findCHOLMOD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(CHOLMOD_LIBRARIES)
find_library(AMD_LIBRARY amd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR}
${LIB_INSTALL_DIR})
if(AMD_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${AMD_LIBRARY})
list(APPEND CHOLMOD_DEPENDENCIES ${AMD_LIBRARY})
else()
set(CHOLMOD_LIBRARIES FALSE)
endif()
Expand All @@ -38,7 +38,7 @@ if(CHOLMOD_LIBRARIES)
find_library(COLAMD_LIBRARY colamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR}
${LIB_INSTALL_DIR})
if(COLAMD_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${COLAMD_LIBRARY})
list(APPEND CHOLMOD_DEPENDENCIES ${COLAMD_LIBRARY})
else()
set(CHOLMOD_LIBRARIES FALSE)
endif()
Expand All @@ -50,7 +50,7 @@ if(CHOLMOD_LIBRARIES)
find_library(CAMD_LIBRARY camd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR}
${LIB_INSTALL_DIR})
if(CAMD_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CAMD_LIBRARY})
list(APPEND CHOLMOD_DEPENDENCIES ${CAMD_LIBRARY})
else()
set(CHOLMOD_LIBRARIES FALSE)
endif()
Expand All @@ -62,7 +62,7 @@ if(CHOLMOD_LIBRARIES)
find_library(CCOLAMD_LIBRARY ccolamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR}
${LIB_INSTALL_DIR})
if(CCOLAMD_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CCOLAMD_LIBRARY})
list(APPEND CHOLMOD_DEPENDENCIES ${CCOLAMD_LIBRARY})
else()
set(CHOLMOD_LIBRARIES FALSE)
endif()
Expand All @@ -74,7 +74,7 @@ if(CHOLMOD_LIBRARIES)
find_library(CHOLMOD_METIS_LIBRARY metis
PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if(CHOLMOD_METIS_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CHOLMOD_METIS_LIBRARY})
list(APPEND CHOLMOD_DEPENDENCIES ${CHOLMOD_METIS_LIBRARY})
endif()

endif()
Expand All @@ -84,26 +84,28 @@ if(CHOLMOD_LIBRARIES)
find_library(SUITESPARSE_LIBRARY SuiteSparse
PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if(SUITESPARSE_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${SUITESPARSE_LIBRARY})
list(APPEND CHOLMOD_DEPENDENCIES ${SUITESPARSE_LIBRARY})
endif()

endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CHOLMOD DEFAULT_MSG CHOLMOD_INCLUDES
CHOLMOD_LIBRARIES)
CHOLMOD_LIBRARIES CHOLMOD_DEPENDENCIES)

if(CHOLMOD_LIBRARIES)
add_library(CHOLMOD::CHOLMOD SHARED IMPORTED)
set_target_properties(
CHOLMOD::CHOLMOD
PROPERTIES IMPORTED_LOCATION ${CHOLMOD_LIBRARIES}
PROPERTIES IMPORTED_LOCATION "${CHOLMOD_LIBRARIES}"
INTERFACE_LINK_LIBRARIES ${CHOLMOD_DEPENDENCIES}
INTERFACE_INCLUDE_DIRECTORIES "${CHOLMOD_INCLUDES}")
endif(CHOLMOD_LIBRARIES)

mark_as_advanced(
CHOLMOD_INCLUDES
CHOLMOD_LIBRARIES
CHOLMOD_DEPENDENCIES
AMD_LIBRARY
COLAMD_LIBRARY
SUITESPARSE_LIBRARY
Expand Down

0 comments on commit acef690

Please sign in to comment.