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
00056 # ----------------------------------------------------------------------------
00057 # initialize search
00058 if (NOT LIBLINEAR_DIR)
00059 set (LIBLINEAR_DIR "$ENV{LIBLINEAR_DIR}" CACHE PATH "Installation prefix for LIBLINEAR." FORCE)
00060 endif ()
00061
00062 if (NOT MEX_EXT)
00063 if (COMMAND basis_mexext)
00064 basis_mexext (MEX_EXT)
00065 else ()
00066 set (MEX_EXT "mexa64")
00067 endif ()
00068 endif ()
00069
00070 #--------------------------------------------------------------
00071 # find paths/files
00072 if (LIBLINEAR_DIR)
00073
00074 find_file (
00075 LIBLINEAR_libsvmwrite_MEX
00076 NAMES libsvmwrite.${MEX_EXT}
00077 HINTS ${LIBLINEAR_DIR}
00078 PATH_SUFFIXES "matlab"
00079 DOC "The libsvmwrite MEX-file of the LIBLINEAR library."
00080 NO_DEFAULT_PATH
00081 )
00082
00083 find_file (
00084 LIBLINEAR_libsvmread_MEX
00085 NAMES libsvmread.${MEX_EXT}
00086 HINTS ${LIBLINEAR_DIR}
00087 PATH_SUFFIXES "matlab"
00088 DOC "The libsvmread MEX-file of the LIBLINEAR library."
00089 NO_DEFAULT_PATH
00090 )
00091
00092 find_file (
00093 LIBLINEAR_train_MEX
00094 NAMES train.${MEX_EXT}
00095 HINTS ${LIBLINEAR_DIR}
00096 PATH_SUFFIXES "matlab"
00097 DOC "The train MEX-file of the LIBLINEAR library."
00098 NO_DEFAULT_PATH
00099 )
00100
00101 find_file (
00102 LIBLINEAR_predict_MEX
00103 NAMES predict.${MEX_EXT}
00104 HINTS ${LIBLINEAR_DIR}
00105 PATH_SUFFIXES "matlab"
00106 DOC "The predict MEX-file of the LIBLINEAR library."
00107 NO_DEFAULT_PATH
00108 )
00109
00110 else ()
00111
00112 find_file (
00113 LIBLINEAR_libsvmwrite_MEX
00114 NAMES libsvmwrite.${MEX_EXT}
00115 PATH_SUFFIXES "matlab"
00116 DOC "The libsvmwrite MEX-file of the LIBLINEAR library."
00117 )
00118
00119 find_file (
00120 LIBLINEAR_libsvmread_MEX
00121 NAMES libsvmread.${MEX_EXT}
00122 PATH_SUFFIXES "matlab"
00123 DOC "The libsvmread MEX-file of the LIBLINEAR library."
00124 )
00125
00126 find_file (
00127 LIBLINEAR_train_MEX
00128 NAMES train.${MEX_EXT}
00129 PATH_SUFFIXES "matlab"
00130 DOC "The train MEX-file of the LIBLINEAR library."
00131 )
00132
00133 find_file (
00134 LIBLINEAR_predict_MEX
00135 NAMES predict.${MEX_EXT}
00136 PATH_SUFFIXES "matlab"
00137 DOC "The predict MEX-file of the LIBLINEAR library."
00138 )
00139
00140 endif ()
00141
00142 mark_as_advanced (LIBLINEAR_libsvmread_MEX)
00143 mark_as_advanced (LIBLINEAR_libsvmwrite_MEX)
00144 mark_as_advanced (LIBLINEAR_train_MEX)
00145 mark_as_advanced (LIBLINEAR_predict_MEX)
00146
00147 set (LIBLINEAR_MEX_FILES)
00148 if (LIBLINEAR_libsvmread_MEX)
00149 list (APPEND LIBLINEAR_MEX_FILES "${LIBLINEAR_libsvmread_MEX}")
00150 endif ()
00151 if (LIBLINEAR_libsvmwrite_MEX)
00152 list (APPEND LIBLINEAR_MEX_FILES "${LIBLINEAR_libsvmwrite_MEX}")
00153 endif ()
00154 if (LIBLINEAR_train_MEX)
00155 list (APPEND LIBLINEAR_MEX_FILES "${LIBLINEAR_train_MEX}")
00156 endif ()
00157 if (LIBLINEAR_predict_MEX)
00158 list (APPEND LIBLINEAR_MEX_FILES "${LIBLINEAR_predict_MEX}")
00159 endif ()
00160
00161 # ----------------------------------------------------------------------------
00162 # handle the QUIETLY and REQUIRED arguments and set *_FOUND to TRUE
00163 # if all listed variables are found or TRUE
00164 include (FindPackageHandleStandardArgs)
00165
00166 find_package_handle_standard_args (
00167 LIBLINEAR
00168 # MESSAGE
00169 DEFAULT_MSG
00170 # VARIABLES
00171 LIBLINEAR_libsvmwrite_MEX
00172 LIBLINEAR_libsvmread_MEX
00173 LIBLINEAR_predict_MEX
00174 LIBLINEAR_train_MEX
00175 )
00176
00177 # ----------------------------------------------------------------------------
00178 # set LIBLINEAR_DIR
00179 if (NOT LIBLINEAR_DIR AND LIBLINEAR_FOUND)
00180 string (REGEX REPLACE "matlab/[^/]+" "" LIBLINEAR_PREFIX "${LIBLINEAR_train_MEX}")
00181 set (LIBLINEAR_DIR "${LIBLINEAR_PREFIX}" CACHE PATH "Installation prefix for LIBLINEAR." FORCE)
00182 unset (LIBLINEAR_PREFIX)
00183 endif ()