-
Notifications
You must be signed in to change notification settings - Fork 217
/
CMakeLists.txt
58 lines (53 loc) · 2.37 KB
/
CMakeLists.txt
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
53
54
55
56
57
58
# -----------------------------------------------
# Test CMake script for building against SuiteSparse
# http://code.google.com/p/suitesparse-metis-for-windows/
# Created by Jose Luis Blanco (University of Almeria) 2013
# Updated by jesnault ([email protected]) 2014-01-21
# Updated by NeroBurner ([email protected]) 2019-04-11
# -----------------------------------------------
# Hunter stuff must be included before project()
if (WIN32)
set(HUNTER_ENABLED_DEFAULT ON)
else()
set(HUNTER_ENABLED_DEFAULT OFF)
endif()
option(HUNTER_ENABLED "Enable Hunter package manager support" ${HUNTER_ENABLED_DEFAULT})
include("../../cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.244.tar.gz"
SHA1 "2c0f491fd0b80f7b09e3d21adb97237161ef9835"
)
project(CholmodExample C)
cmake_minimum_required(VERSION 3.1)
include(CheckLanguage)
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
enable_language(Fortran)
else()
# if there are undefined references like "undefined reference to '_gfortran_st_write'"
# try to install a fortran compiler like gfortran
message(STATUS "No Fortran support. If there are link errors try installing gfortran (or similar)")
endif()
# ------------------------------------------------------------------
# Detect SuiteSparse libraries:
# Either tell Hunter to provide SuiteSparse for you or manually
# define where SuiteSparse and LAPACK can be found.
# To activate Hunter use the following commandline
# cmake -S . -B _build -DHUNTER_ENABLED=ON
#
# In the manual case, if not found automatically, set SuiteSparse_DIR
# in CMake to the directory containing suitesparse-config.cmake located
# in the installed directory.
# for example use the following command line
# cmake -S . -B _build -DSuiteSparse_DIR=../../_install/lib/cmake/suitesparse-5.1.0
# ------------------------------------------------------------------
hunter_add_package(SuiteSparse)
find_package(SuiteSparse CONFIG REQUIRED)
# ------------------------------------------------------------------
# End of SuiteSparse detection
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# Declare an example program:
# ------------------------------------------------------------------
add_executable(cholmod-test cholmod-test.c)
target_link_libraries(cholmod-test PRIVATE SuiteSparse::cholmod)