FindMatlabNiftiTools.cmake
Go to the documentation of this file.
00001 ############################################################################## 00002 # @file FindMatlabNiftiTools.cmake 00003 # @brief Find MATLAB Central package "Tools for NIfTI and ANALYZE Image" (#8797). 00004 # 00005 # @par Input variables: 00006 # <table border="0"> 00007 # <tr> 00008 # @tp @b MatlabNiftiTools_DIR @endtp 00009 # <td>The MATLAB Central package files are searched under the specified 00010 # root directory. If they are not found there, the default search 00011 # paths are considered. This variable can also be set as 00012 # environment variable.</td> 00013 # </tr> 00014 # <tr> 00015 # @tp @b MATLABNIFTITOOLS_DIR @endtp 00016 # <td>Alternative environment variable for @p MatlabNiftiTools_DIR.</td> 00017 # </tr> 00018 # </table> 00019 # 00020 # @par Output variables: 00021 # <table border="0"> 00022 # <tr> 00023 # @tp @b MatlabNiftiTools_FOUND @endtp 00024 # <td>Whether the package was found and the following CMake variables are valid.</td> 00025 # </tr> 00026 # <tr> 00027 # @tp @b MatlabNiftiTools_INCLUDE_DIR @endtp 00028 # <td>Cached include directory/ies only related to the searched package.</td> 00029 # </tr> 00030 # <tr> 00031 # @tp @b MatlabNiftiTools_INCLUDE_DIRS @endtp 00032 # <td>Include directory/ies of searched and dependent packages (not cached).</td> 00033 # </tr> 00034 # <tr> 00035 # @tp @b MatlabNiftiTools_INCLUDES @endtp 00036 # <td>Alias for MatlabNiftiTools_INCLUDE_DIRS (not cached).</td> 00037 # </tr> 00038 # </table> 00039 # 00040 # Copyright (c) 2011, 2012 University of Pennsylvania. All rights reserved.<br /> 00041 # See https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file. 00042 # 00043 # Contact: SBIA Group <sbia-software at uphs.upenn.edu> 00044 # 00045 # @ingroup CMakeFindModules 00046 ############################################################################## 00047 00048 # ---------------------------------------------------------------------------- 00049 # initialize search 00050 if (NOT MatlabNiftiTools_DIR) 00051 if (NOT $ENV{MATLABNIFTITOOLS_DIR} STREQUAL "") 00052 set (MatlabNiftiTools_DIR "$ENV{MATLABNIFTITOOLS_DIR}" CACHE PATH "Installation prefix for MATLAB NIfTI tools." FORCE) 00053 else () 00054 set (MatlabNiftiTools_DIR "$ENV{MatlabNiftiTools_DIR}" CACHE PATH "Installation prefix for MATLAB NIfTI tools." FORCE) 00055 endif () 00056 endif () 00057 00058 # ---------------------------------------------------------------------------- 00059 # find paths / files 00060 if (MatlabNiftiTools_DIR) 00061 00062 find_path ( 00063 MatlabNiftiTools_INCLUDE_DIR 00064 NAMES load_nii.m 00065 HINTS ${MatlabNiftiTools_DIR} 00066 DOC "Path of directory containing load_nii.m" 00067 NO_DEFAULT_PATH 00068 ) 00069 00070 else () 00071 00072 find_path ( 00073 MatlabNiftiTools_INCLUDE_DIR 00074 NAMES load_nii.m 00075 HINTS ENV MATLABPATH 00076 DOC "Path of directory containing load_nii.m" 00077 ) 00078 00079 endif () 00080 00081 # ---------------------------------------------------------------------------- 00082 # append paths / libraries of packages this package depends on 00083 if (MatlabNiftiTools_INCLUDE_DIR) 00084 set (MatlabNiftiTools_INCLUDE_DIRS "${MatlabNiftiTools_INCLUDE_DIR}") 00085 set (MatlabNiftiTools_INCLUDES "${MatlabNiftiTools_INCLUDE_DIRS}") 00086 endif () 00087 00088 # ---------------------------------------------------------------------------- 00089 # handle the QUIETLY and REQUIRED arguments and set *_FOUND to TRUE 00090 # if all listed variables are found or TRUE 00091 include (FindPackageHandleStandardArgs) 00092 00093 find_package_handle_standard_args ( 00094 MatlabNiftiTools 00095 REQUIRED_ARGS 00096 MatlabNiftiTools_INCLUDE_DIR 00097 ) 00098 00099 set (MatlabNiftiTools_FOUND "${MATLABNIFTITOOLS_FOUND}") 00100 00101 # ---------------------------------------------------------------------------- 00102 # set MatlabNiftiTools_DIR 00103 if (NOT MatlabNiftiTools_DIR AND MatlabNiftiTools_FOUND) 00104 set (MatlabNiftiTools_DIR "${MatlabNiftiTools_INCLUDE_DIR}" CACHE PATH "Installation prefix for MATLAB NIfTI tools." FORCE) 00105 endif ()