forked from sofa-framework/Sofa.Metis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
52 lines (42 loc) · 1.79 KB
/
CMakeLists.txt
File metadata and controls
52 lines (42 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
cmake_minimum_required(VERSION 3.22)
project(Sofa.Metis LANGUAGES C CXX)
set(SOFAMETIS_SOURCE_DIR "src/sofa/metis")
set(HEADER_FILES
${SOFAMETIS_SOURCE_DIR}/config.h.in
${SOFAMETIS_SOURCE_DIR}/init.h
${SOFAMETIS_SOURCE_DIR}/MetisOrderingMethod.h
)
set(SOURCE_FILES
${SOFAMETIS_SOURCE_DIR}/init.cpp
${SOFAMETIS_SOURCE_DIR}/MetisOrderingMethod.cpp
)
find_package(Sofa.Component.LinearSolver.Direct REQUIRED)
find_package(metis 5.1.0 EXACT QUIET)
if(NOT metis_FOUND AND SOFA_ALLOW_FETCH_DEPENDENCIES)
message("Sofa.Metis: DEPENDENCY metis NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is ON, fetching metis...")
sofa_fetch_dependency(metis
GIT_REPOSITORY https://github.com/sofa-framework/METIS
GIT_TAG v5.1.0-ModernInstall
)
elseif (NOT metis_FOUND)
message(FATAL_ERROR "Sofa.Metis: DEPENDENCY metis NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is OFF and thus cannot be fetched. Install metis (version=5.2.1), or enable SOFA_ALLOW_FETCH_DEPENDENCIES to fix this issue.")
endif()
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Component.LinearSolver.Direct)
target_link_libraries(${PROJECT_NAME} PRIVATE metis)
sofa_create_package_with_targets(
PACKAGE_NAME ${PROJECT_NAME}
PACKAGE_VERSION ${Sofa_VERSION}
TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES
INCLUDE_SOURCE_DIR "src"
INCLUDE_INSTALL_DIR ${PROJECT_NAME}
EXAMPLE_INSTALL_DIR "examples"
RELOCATABLE "plugins"
)
# Tests
# If SOFA_BUILD_TESTS exists and is OFF, then these tests will be auto-disabled
cmake_dependent_option(SOFA_METIS_BUILD_TESTS "Compile the automatic tests" ON "SOFA_BUILD_TESTS OR NOT DEFINED SOFA_BUILD_TESTS" OFF)
if(SOFA_METIS_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()