1 ############################################################################## 2 # @file FindMOSEK.cmake 3 # @brief Find MOSEK (http://www.mosek.com) package. 5 # @par Input variables: 8 # @tp @b MOSEK_DIR @endtp 9 # <td>The MOSEK package files are searched under the specified root 10 # directory. If they are not found there, the default search paths 11 # are considered. This variable can also be set as environment variable.</td> 14 # @tp @b MOSEK_NO_OMP @endtp 15 # <td>Whether to use the link libraries build without OpenMP, i.e., 16 # multi-threading, enabled. By default, the multi-threaded libraries 20 # @tp @b MOSEK_FIND_COMPONENTS @endtp 21 # <td>The @c COMPONENTS argument(s) of the find_package() command can 22 # be used to also look for optional MOSEK components. 23 # Valid component values are "mex", "jar", and "pypkg".</td> 26 # @tp @b MOSEK_TOOLS_SUFFIX @endtp 27 # <td>Platform specific path suffix for tools, i.e., "tools/platform/linux64x86" 28 # on 64-bit Linux systems. If not specified, this module determines the 29 # right suffix depending on the CMake system variables.</td> 32 # @tp @b MATLAB_RELEASE @endtp 33 # <td>Release of MATLAB installation. Set to the 'Release' return value of 34 # the "ver ('MATLAB')" command of MATLAB without brackets. If this 35 # variable is not set and the basis_get_matlab_release() command is 36 # available, it is invoked to determine the release version automatically. 37 # Otherwise, an error is raised if the "mex" component is searched.</td> 40 # @tp @b MEX_EXT @endtp 41 # <td>The extension of MEX-files. If this variable is not set and the 42 # basis_mexext() command is available, it is invoked to determine the 43 # extension automatically. Otherwise, the MEX extension defaults to "mexa64".</td> 46 # @tp @b PYTHON_VERSION_MAJOR @endtp 47 # <td>Major version of Python installation as determined by FindPythonInterp.cmake module.</td> 51 # @par Output variables: 54 # @tp @b MOSEK_FOUND @endtp 55 # <td>Whether the package was found and the following CMake variables are valid.</td> 58 # @tp @b MOSEK_<component>_FOUND @endtp 59 # <td>Whether the component requested by @c MOSEK_FIND_COMPONENTS was found.</td> 62 # @tp @b MOSEK_INCLUDE_DIR @endtp 63 # <td>Package include directories.</td> 66 # @tp @b MOSEK_INCLUDES @endtp 67 # <td>Include directories including prerequisite libraries (non-cached).</td> 70 # @tp @b MOSEK_LIBRARY @endtp 71 # <td>Package libraries.</td> 74 # @tp @b MOSEK_LIBRARIES @endtp 75 # <td>Package libraries and prerequisite libraries (non-cached).</td> 78 # @tp @b MOSEK_mosekopt_MEX @endtp 79 # <td>Package mosekopt MEX-file.</td> 82 # @tp @b MOSEK_MEX_FILES @endtp 83 # <td>List of MEX-files (non-cached).</td> 86 # @tp @b MOSEK_mosek_JAR @endtp 87 # <td>Package mosek Java library (.jar file).</td> 90 # @tp @b MOSEK_CLASSPATH @endtp 91 # <td>List of Java package libraries and prerequisite libraries (non-cached).</td> 94 # @tp @b MOSEK_PYTHONPATH @endtp 95 # <td>Path to Python modules of this package.</td> 99 # @ingroup CMakeFindModules 100 ############################################################################## 102 #============================================================================= 103 # Copyright 2011-2012 University of Pennsylvania 104 # Copyright 2013-2016 Andreas Schuh <andreas.schuh.84@gmail.com> 106 # Distributed under the OSI-approved BSD License (the "License"); 107 # see accompanying file Copyright.txt for details. 109 # This software is distributed WITHOUT ANY WARRANTY; without even the 110 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 111 # See the License for more information. 112 #============================================================================= 113 # (To distribute this file outside of CMake, substitute the full 114 # License text for the above reference.) 116 # ---------------------------------------------------------------------------- 117 # optional components to look for 120 set (MOSEK_FIND_${CMP} FALSE)
122 foreach (CMP IN LISTS MOSEK_FIND_COMPONENTS)
123 if (NOT CMP MATCHES
"^(mex|jar|pypkg)$")
124 message (FATAL_ERROR
"Invalid MOSEK component: ${CMP}")
126 set (MOSEK_FIND_${CMP} TRUE)
129 # ---------------------------------------------------------------------------- 130 # remember CMAKE_FIND_LIBRARY_SUFFIXES to be able to restore it 133 # ----------------------------------------------------------------------------
134 # versions - library suffixes
136 # known MOSEK versions, all entries have to be specified in descending order!
140 # get a full list of particular versions (<major>.<minor>) to look for 141 set (_MOSEK_FIND_VERSIONS)
142 if (MOSEK_FIND_VERSION)
143 if (MOSEK_FIND_VERSION MATCHES
"^([0-9]+\\.[0-9]+)(\\.[0-9]+.*)?$")
146 if (NOT MOSEK_FIND_VERSION_EXACT)
147 string (REGEX REPLACE
"^([0-9]+).*" "\\1" _MOSEK_FIND_VERSION_MAJOR
"${CMAKE_MATCH_1}")
148 foreach (_MOSEK_VERSION IN LISTS _MOSEK${_MOSEK_FIND_VERSION_MAJOR}_VERSIONS)
150 list (APPEND _MOSEK_FIND_VERSIONS ${_MOSEK_VERSION})
153 unset (_MOSEK_FIND_VERSION_MAJOR)
155 unset (_MOSEK_FIND_VERSION_MAJOR_MINOR)
158 list (APPEND _MOSEK_LIBRARY_SUFFIXES .dylib.${_MOSEK_FIND_VERSION_MAJOR_MINOR})
160 list (APPEND _MOSEK_LIBRARY_SUFFIXES .so.${_MOSEK_FIND_VERSION_MAJOR_MINOR})
166 list (APPEND _MOSEK_FIND_VERSIONS ${_MOSEK${_MOSEK_VERSION_MAJOR}_VERSIONS})
170 # ---------------------------------------------------------------------------- 173 set (MOSEK_DIR
"$ENV{MOSEK_DIR}" CACHE PATH
"Installation prefix for MOSEK." FORCE)
179 if (NOT MATLAB_RELEASE)
182 if (NOT MATLAB_RELEASE)
183 message (FATAL_ERROR "Failed to determine release version of MATLAB installation."
184 " This information
is required to be able to find the right MOSEK MEX-files."
185 " Alternatively, set MATLAB_RELEASE manually and
try again.")
188 message (FATAL_ERROR "MATLAB_RELEASE variable not set."
189 " This information
is required to be able to find the right MOSEK MEX-files."
190 " Set MATLAB_RELEASE to the correct MATLAB release version,
e.g., R2009b,"
194 string (TOLOWER "${MATLAB_RELEASE}
" MATLAB_RELEASE_L) 195 # search path for MOSEK MATLAB toolbox 196 if (NOT MOSEK_TOOLBOX_SUFFIX) 200 MOSEK_TOOLBOX_SUFFIXES 201 RELATIVE "${MOSEK_DIR}
" 202 "${MOSEK_DIR}/toolbox
function basis_get_matlab_release(out ARGV1)
Get release version of MATLAB installation.
function is(in result, in expected, in name)
Test whether a given result is equal to the expected result.
cmake _MOSEK_CMAKE_FIND_LIBRARY_SUFFIXES
cmake _MOSEK_OPTIONAL_COMPONENTS
cmake _MOSEK_FIND_OTHER_VERSIONS
#define UNIX
Whether the sources are compiled on a Unix-based system.
cmake _MOSEK_VERSIONS_MAJOR
cmake _MOSEK_FIND_VERSION_MAJOR_MINOR