1 ############################################################################## 2 # @file FindSVMTorch.cmake 3 # @brief Find SVMTorch II package. 5 # @par Input varibales: 8 # @tp @b SVMTorch_DIR @endtp 9 # <td>The SVMTorch package files are searched primarily under the specified 10 # root directory. This variable can be alternatively set as environment 14 # @tp @b SVMTorch_FIND_COMPONENTS @endtp 15 # <td>@c COMPONENTS of SVMTorch to look for: @c train, @c test, @c lib. (default: @c train, @c test)</td> 18 # @tp @b SVMTorch_FIND_OPTIONAL_COMPONENTS @endtp 19 # <td>@c OPTIONAL_COMPONENTS of SVMTorch to look for: @c train, @c test, @c lib. (default: @c lib)</td> 23 # @par Output variables: 26 # @tp @b SVMTorch_FOUND @endtp 27 # <td>Whether the package was found and the following CMake variables are valid.</td> 30 # @tp @b SVMTorch_INCLUDE_DIR @endtp 31 # <td>The directory containing the include files.</td> 34 # @tp @b SVMTorch_LIBRARY @endtp 35 # <td>Found object files (.o).</td> 38 # @tp @b SVMTorch_train_EXECUTABLE @endtp 39 # <td>Absolute path of found @c SVMTorch executable.</td> 42 # @tp @b SVMTorch_test_EXECUTABLE @endtp 43 # <td>Absolute path of found @c SVMTest executable.</td> 46 # @tp @b svmtorch.SVMTorch @endtp 47 # <td>Import target of @c SVMTorch executable.</td> 50 # @tp @b svmtorch.SVMTest @endtp 51 # <td>Import target of @c SVMTest executable.</td> 55 # @ingroup CMakeFindModules 56 ############################################################################## 58 #============================================================================= 59 # Copyright 2011-2012 University of Pennsylvania 60 # Copyright 2013-2016 Andreas Schuh <andreas.schuh.84@gmail.com> 62 # Distributed under the OSI-approved BSD License (the "License"); 63 # see accompanying file Copyright.txt for details. 65 # This software is distributed WITHOUT ANY WARRANTY; without even the 66 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 67 # See the License for more information. 68 #============================================================================= 69 # (To distribute this file outside of CMake, substitute the full 70 # License text for the above reference.) 72 # ---------------------------------------------------------------------------- 75 set (SVMTorch_DIR
"$ENV{SVMTorch_DIR}" CACHE PATH
"Installation prefix of SVMTorch." FORCE)
80 set (SVMTorch_FIND_OPTIONAL_COMPONENTS lib)
86 if (NOT _SVMTorch_C MATCHES
"^(train|test|lib)$")
87 message (FATAL_ERROR
"Invalid SVMTorch component: ${_SVMTorch_C}")
92 #-------------------------------------------------------------- 94 if (_SVMTorch_COMPONENTS MATCHES train)
97 SVMTorch_train_EXECUTABLE
100 DOC
"The SVMTorch executable." 105 SVMTorch_train_EXECUTABLE
107 DOC
"The SVMTorch executable." 110 mark_as_advanced (SVMTorch_train_EXECUTABLE)
111 if (SVMTorch_train_EXECUTABLE)
113 set_target_properties (svmtorch.SVMTorch PROPERTIES IMPORTED_LOCATION
"${SVMTorch_train_EXECUTABLE}")
117 if (_SVMTorch_COMPONENTS MATCHES test)
120 SVMTorch_test_EXECUTABLE
122 HINTS ${SVMTorch_DIR}
123 DOC
"The SVMTest executable." 128 SVMTorch_test_EXECUTABLE
130 DOC
"The SVMTest executable." 133 mark_as_advanced (SVMTorch_test_EXECUTABLE)
134 if (SVMTorch_test_EXECUTABLE)
140 #-------------------------------------------------------------- 141 # derive SVMTorch_DIR if not set yet 142 if (NOT SVMTorch_DIR)
143 if (SVMTorch_train_EXECUTABLE)
145 elseif (SVMTorch_test_EXECUTABLE)
148 set (SVMTorch_DIR
"${SVMTorch_DIR}" CACHE PATH
"Installation prefix of SVMTorch." FORCE)
151 #-------------------------------------------------------------- 152 # find header files and built object files 153 set (SVMTorch_LIBRARY)
154 if (_SVMTorch_COMPONENTS MATCHES lib)
159 HINTS
"${SVMTorch_DIR}" 160 DOC
"Directory containing the header files of SVMTorch (i.e., IOTorch.h)." 163 file (GLOB SVMTorch_OBJ_FILES
"${SVMTorch_DIR}/*.o")
164 foreach (_SVMTorch_OBJ_FILE IN LISTS SVMTorch_OBJ_FILES)
165 if (NOT _SVMTorch_OBJ_FILE MATCHES
"convert.o$|SVMTorch.o$|SVMTest.o$")
166 list (APPEND SVMTorch_LIBRARY
"${_SVMTorch_OBJ_FILE}")
169 unset (_SVMTorch_OBJ_FILE)
170 mark_as_advanced (SVMTorch_INCLUDE_DIR)
175 DOC
"Directory containing the header files of SVMTorch (i.e., IOTorch.h)." 177 mark_as_advanced (SVMTorch_INCLUDE_DIR)
181 # ---------------------------------------------------------------------------- 182 # handle the QUIETLY and REQUIRED arguments and set *_FOUND to TRUE 183 # if all listed variables are found or TRUE 184 include (FindPackageHandleStandardArgs)
186 set (SVMTorch_REQUIRED_VARS)
188 list (APPEND SVMTorch_REQUIRED_VARS SVMTorch_train_EXECUTABLE)
191 list (APPEND SVMTorch_REQUIRED_VARS SVMTorch_test_EXECUTABLE)
194 list (APPEND SVMTorch_REQUIRED_VARS SVMTorch_INCLUDE_DIR)
195 list (APPEND SVMTorch_REQUIRED_VARS SVMTorch_LIBRARY)
198 find_package_handle_standard_args (SVMTorch DEFAULT_MSG ${SVMTorch_REQUIRED_VARS})
201 unset (_SVMTorch_COMPONENTS)
function set_target_properties(in ARGN)
Set target property.
cmake SVMTorch_FIND_OPTIONAL_COMPONENTS
function add_executable(in TARGET_UID, in ARGN)
Add executable target.
cmake _SVMTorch_COMPONENTS
cmake SVMTorch_FIND_COMPONENTS
function get_filename_component(inout ARGN)
Fixes CMake's get_filename_component() command.