Skip to content

Commit 663bcea

Browse files
committed
cmake: make FindMETIS.cmake visible in CMAKE_MODULE_PATH
Ensure the find module is usable both from install prefix and build directory.
1 parent 48cde4d commit 663bcea

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,18 @@ if (WITH_CHOLMOD)
351351
CHOLMOD/Partition/cholmod_metis.c
352352
CHOLMOD/Partition/cholmod_nesdis.c
353353
APPEND PROPERTY COMPILE_DEFINITIONS NPARTITION)
354+
else (NOT WITH_METIS OR NOT METIS_FOUND)
355+
set (_METIS_IN ${SuiteSparse_SOURCE_DIR}/cmake/FindMETIS.cmake)
356+
set (_METIS_OUT ${SuiteSparse_BINARY_DIR}/FindMETIS.cmake)
357+
358+
add_custom_command (
359+
OUTPUT ${_METIS_OUT}
360+
COMMAND ${CMAKE_COMMAND} -E create_symlink ${_METIS_IN} ${_METIS_OUT}
361+
DEPENDS ${_METIS_IN}
362+
COMMENT "Creating FindMETIS.cmake symlink in build directory"
363+
)
364+
365+
list (APPEND CHOLMOD_SRCS ${_METIS_OUT})
354366
endif (NOT WITH_METIS OR NOT METIS_FOUND)
355367

356368
configure_file (CHOLMOD/Include/cholmod_config.h.cmake.in

suitesparse-config.cmake.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ endif (CMAKE_VERSION VERSION_LESS 3.18)
44

55
@PACKAGE_INIT@
66

7+
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
8+
79
include (CMakeFindDependencyMacro)
810

911
find_dependency (BLAS)

0 commit comments

Comments
 (0)