-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathFindMatlabNiftiTools.cmake
114 lines (102 loc) · 4.02 KB
/
FindMatlabNiftiTools.cmake
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
##############################################################################
# @file FindMatlabNiftiTools.cmake
# @brief Find MATLAB Central package "Tools for NIfTI and ANALYZE Image" (#8797).
#
# @par Input variables:
# <table border="0">
# <tr>
# @tp @b MatlabNiftiTools_DIR @endtp
# <td>The MATLAB Central package files are searched under the specified
# root directory. If they are not found there, the default search
# paths are considered. This variable can also be set as
# environment variable.</td>
# </tr>
# <tr>
# @tp @b MATLABNIFTITOOLS_DIR @endtp
# <td>Alternative environment variable for @p MatlabNiftiTools_DIR.</td>
# </tr>
# </table>
#
# @par Output variables:
# <table border="0">
# <tr>
# @tp @b MatlabNiftiTools_FOUND @endtp
# <td>Whether the package was found and the following CMake variables are valid.</td>
# </tr>
# <tr>
# @tp @b MatlabNiftiTools_INCLUDE_DIR @endtp
# <td>Cached include directory/ies only related to the searched package.</td>
# </tr>
# <tr>
# @tp @b MatlabNiftiTools_INCLUDE_DIRS @endtp
# <td>Include directory/ies of searched and dependent packages (not cached).</td>
# </tr>
# <tr>
# @tp @b MatlabNiftiTools_INCLUDES @endtp
# <td>Alias for MatlabNiftiTools_INCLUDE_DIRS (not cached).</td>
# </tr>
# </table>
#
# @ingroup CMakeFindModules
##############################################################################
#=============================================================================
# Copyright 2011-2012 University of Pennsylvania
# Copyright 2013-2016 Andreas Schuh <andreas.schuh.84@gmail.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# ----------------------------------------------------------------------------
# initialize search
if (NOT MatlabNiftiTools_DIR)
if (NOT $ENV{MATLABNIFTITOOLS_DIR} STREQUAL "")
set (MatlabNiftiTools_DIR "$ENV{MATLABNIFTITOOLS_DIR}" CACHE PATH "Installation prefix for MATLAB NIfTI tools." FORCE)
else ()
set (MatlabNiftiTools_DIR "$ENV{MatlabNiftiTools_DIR}" CACHE PATH "Installation prefix for MATLAB NIfTI tools." FORCE)
endif ()
endif ()
# ----------------------------------------------------------------------------
# find paths / files
if (MatlabNiftiTools_DIR)
find_path (
MatlabNiftiTools_INCLUDE_DIR
NAMES load_nii.m
HINTS ${MatlabNiftiTools_DIR}
DOC "path to directory containing load_nii.m"
NO_DEFAULT_PATH
)
else ()
find_path (
MatlabNiftiTools_INCLUDE_DIR
NAMES load_nii.m
HINTS ENV MATLABPATH
DOC "path to directory containing load_nii.m"
)
endif ()
# ----------------------------------------------------------------------------
# append paths / libraries of packages this package depends on
if (MatlabNiftiTools_INCLUDE_DIR)
set (MatlabNiftiTools_INCLUDE_DIRS "${MatlabNiftiTools_INCLUDE_DIR}")
set (MatlabNiftiTools_INCLUDES "${MatlabNiftiTools_INCLUDE_DIRS}")
endif ()
# ----------------------------------------------------------------------------
# handle the QUIETLY and REQUIRED arguments and set *_FOUND to TRUE
# if all listed variables are found or TRUE
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (
MatlabNiftiTools
REQUIRED_ARGS
MatlabNiftiTools_INCLUDE_DIR
)
set (MatlabNiftiTools_FOUND "${MATLABNIFTITOOLS_FOUND}")
# ----------------------------------------------------------------------------
# set MatlabNiftiTools_DIR
if (NOT MatlabNiftiTools_DIR AND MatlabNiftiTools_FOUND)
set (MatlabNiftiTools_DIR "${MatlabNiftiTools_INCLUDE_DIR}" CACHE PATH "Installation prefix for MATLAB NIfTI tools." FORCE)
endif ()