FindLIBLINEAR.cmake
Go to the documentation of this file.
00001 ############################################################################## 00002 # @file FindLIBLINEAR.cmake 00003 # @brief Find LIBLINEAR package. 00004 # 00005 # @par Input varibales: 00006 # <table border="0"> 00007 # <tr> 00008 # @tp @b LIBLINEAR_DIR @endtp 00009 # <td>The LIBLINEAR package files are searched primarily under the specified 00010 # root directory. This variable can be alternatively set as environment 00011 # variable.</td> 00012 # </tr> 00013 # <tr> 00014 # @tp @b MEX_EXT @endtp 00015 # <td>The extension of MEX-files. If this variable is not set and the 00016 # basis_mexext command is available, it is invoked to determine the 00017 # extension automatically. Otherwise, the MEX extension defaults to 00018 # "mexa64".</td> 00019 # </tr> 00020 # </table> 00021 # 00022 # @par Output variables: 00023 # <table border="0"> 00024 # <tr> 00025 # @tp @b LIBLINEAR_FOUND @endtp 00026 # <td>Whether the package was found and the following CMake variables are valid.</td> 00027 # </tr> 00028 # <tr> 00029 # @tp @b LIBLINEAR_libsvmwrite_MEX @endtp 00030 # <td>The libsvmwrite MEX-file.</td> 00031 # </tr> 00032 # <tr> 00033 # @tp @b LIBLINEAR_libsvmread_MEX @endtp 00034 # <td>The libsvmread MEX-file.</td> 00035 # </tr> 00036 # <tr> 00037 # @tp @b LIBLINEAR_predict_MEX @endtp 00038 # <td>The predict MEX-file.</td> 00039 # </tr> 00040 # <tr> 00041 # @tp @b LIBLINEAR_train_MEX @endtp 00042 # <td>The train MEX-file.</td> 00043 # </tr> 00044 # <tr> 00045 # @tp @b LIBLINEAR_MEX_FILES @endtp 00046 # <td>List of MEX-files (non-cached).</td> 00047 # </tr> 00048 # </table> 00049 # 00050 # Copyright (c) 2011, 2012 University of Pennsylvania. All rights reserved.<br /> 00051 # See https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file. 00052 # 00053 # Contact: SBIA Group <sbia-software at uphs.upenn.edu> 00054 # 00055 # @ingroup CMakeFindModules 00056 ############################################################################## 00057 00058 # ---------------------------------------------------------------------------- 00059 # initialize search 00060 if (NOT LIBLINEAR_DIR) 00061 set (LIBLINEAR_DIR "$ENV{LIBLINEAR_DIR}" CACHE PATH "Installation prefix for LIBLINEAR." FORCE) 00062 endif () 00063 00064 if (NOT MEX_EXT) 00065 if (COMMAND basis_mexext) 00066 basis_mexext (MEX_EXT) 00067 else () 00068 set (MEX_EXT "mexa64") 00069 endif () 00070 endif () 00071 00072 #-------------------------------------------------------------- 00073 # find paths/files 00074 if (LIBLINEAR_DIR) 00075 00076 find_file ( 00077 LIBLINEAR_libsvmwrite_MEX 00078 NAMES libsvmwrite.${MEX_EXT} 00079 HINTS ${LIBLINEAR_DIR} 00080 PATH_SUFFIXES "matlab" 00081 DOC "The libsvmwrite MEX-file of the LIBLINEAR library." 00082 NO_DEFAULT_PATH 00083 ) 00084 00085 find_file ( 00086 LIBLINEAR_libsvmread_MEX 00087 NAMES libsvmread.${MEX_EXT} 00088 HINTS ${LIBLINEAR_DIR} 00089 PATH_SUFFIXES "matlab" 00090 DOC "The libsvmread MEX-file of the LIBLINEAR library." 00091 NO_DEFAULT_PATH 00092 ) 00093 00094 find_file ( 00095 LIBLINEAR_train_MEX 00096 NAMES train.${MEX_EXT} 00097 HINTS ${LIBLINEAR_DIR} 00098 PATH_SUFFIXES "matlab" 00099 DOC "The train MEX-file of the LIBLINEAR library." 00100 NO_DEFAULT_PATH 00101 ) 00102 00103 find_file ( 00104 LIBLINEAR_predict_MEX 00105 NAMES predict.${MEX_EXT} 00106 HINTS ${LIBLINEAR_DIR} 00107 PATH_SUFFIXES "matlab" 00108 DOC "The predict MEX-file of the LIBLINEAR library." 00109 NO_DEFAULT_PATH 00110 ) 00111 00112 else () 00113 00114 find_file ( 00115 LIBLINEAR_libsvmwrite_MEX 00116 NAMES libsvmwrite.${MEX_EXT} 00117 PATH_SUFFIXES "matlab" 00118 DOC "The libsvmwrite MEX-file of the LIBLINEAR library." 00119 ) 00120 00121 find_file ( 00122 LIBLINEAR_libsvmread_MEX 00123 NAMES libsvmread.${MEX_EXT} 00124 PATH_SUFFIXES "matlab" 00125 DOC "The libsvmread MEX-file of the LIBLINEAR library." 00126 ) 00127 00128 find_file ( 00129 LIBLINEAR_train_MEX 00130 NAMES train.${MEX_EXT} 00131 PATH_SUFFIXES "matlab" 00132 DOC "The train MEX-file of the LIBLINEAR library." 00133 ) 00134 00135 find_file ( 00136 LIBLINEAR_predict_MEX 00137 NAMES predict.${MEX_EXT} 00138 PATH_SUFFIXES "matlab" 00139 DOC "The predict MEX-file of the LIBLINEAR library." 00140 ) 00141 00142 endif () 00143 00144 mark_as_advanced (LIBLINEAR_libsvmread_MEX) 00145 mark_as_advanced (LIBLINEAR_libsvmwrite_MEX) 00146 mark_as_advanced (LIBLINEAR_train_MEX) 00147 mark_as_advanced (LIBLINEAR_predict_MEX) 00148 00149 set (LIBLINEAR_MEX_FILES) 00150 if (LIBLINEAR_libsvmread_MEX) 00151 list (APPEND LIBLINEAR_MEX_FILES "${LIBLINEAR_libsvmread_MEX}") 00152 endif () 00153 if (LIBLINEAR_libsvmwrite_MEX) 00154 list (APPEND LIBLINEAR_MEX_FILES "${LIBLINEAR_libsvmwrite_MEX}") 00155 endif () 00156 if (LIBLINEAR_train_MEX) 00157 list (APPEND LIBLINEAR_MEX_FILES "${LIBLINEAR_train_MEX}") 00158 endif () 00159 if (LIBLINEAR_predict_MEX) 00160 list (APPEND LIBLINEAR_MEX_FILES "${LIBLINEAR_predict_MEX}") 00161 endif () 00162 00163 # ---------------------------------------------------------------------------- 00164 # handle the QUIETLY and REQUIRED arguments and set *_FOUND to TRUE 00165 # if all listed variables are found or TRUE 00166 include (FindPackageHandleStandardArgs) 00167 00168 find_package_handle_standard_args ( 00169 LIBLINEAR 00170 # MESSAGE 00171 DEFAULT_MSG 00172 # VARIABLES 00173 LIBLINEAR_libsvmwrite_MEX 00174 LIBLINEAR_libsvmread_MEX 00175 LIBLINEAR_predict_MEX 00176 LIBLINEAR_train_MEX 00177 ) 00178 00179 # ---------------------------------------------------------------------------- 00180 # set LIBLINEAR_DIR 00181 if (NOT LIBLINEAR_DIR AND LIBLINEAR_FOUND) 00182 string (REGEX REPLACE "matlab/[^/]+" "" LIBLINEAR_PREFIX "${LIBLINEAR_train_MEX}") 00183 set (LIBLINEAR_DIR "${LIBLINEAR_PREFIX}" CACHE PATH "Installation prefix for LIBLINEAR." FORCE) 00184 unset (LIBLINEAR_PREFIX) 00185 endif ()