Skip to content

Commit

Permalink
external/cholmod: fix finder
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarpent committed Feb 11, 2024
1 parent dd568f7 commit 5f36071
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 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,20 +84,21 @@ 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)

Expand Down

0 comments on commit 5f36071

Please sign in to comment.