FindMETIS.cmake 3.02 KB
Newer Older
David Bommes's avatar
changed    
David Bommes committed
1
2
3
4
5
6
7
8
9
10
11
12
# - Try to find METIS
# Once done this will define
#  METIS_FOUND - System has Metis
#  METIS_INCLUDE_DIRS - The Metis include directories
#  METIS_LIBRARY_DIRS - The library directories needed to use Metis
#  METIS_LIBRARIES    - The libraries needed to use Metis

if (METIS_INCLUDE_DIR)
  # in cache already
  SET(METIS_FIND_QUIETLY TRUE)
endif (METIS_INCLUDE_DIR)

Jan Möbius's avatar
Jan Möbius committed
13
14
15
16
17
18
# Check if the base path is set
if ( NOT CMAKE_WINDOWS_LIBS_DIR )
  # This is the base directory for windows library search used in the finders we shipp.
  set(CMAKE_WINDOWS_LIBS_DIR "c:/libs" CACHE STRING "Default Library search dir on windows." )
endif()

Jan Möbius's avatar
Jan Möbius committed
19
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*Win64" )
Jan Möbius's avatar
Jan Möbius committed
20
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x64/")
Jan Möbius's avatar
Jan Möbius committed
21
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
Jan Möbius's avatar
Jan Möbius committed
22
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x32/")
Jan Möbius's avatar
Jan Möbius committed
23
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*Win64" )
Jan Möbius's avatar
Jan Möbius committed
24
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x64/")
Jan Möbius's avatar
Jan Möbius committed
25
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*" )
Jan Möbius's avatar
Jan Möbius committed
26
27
28
29
30
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x32/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*Win64" )
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*" )
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x32/")
31
32
33
34
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15.*Win64" )
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2017/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15.*" )
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2017/x32/")
Jan Möbius's avatar
Jan Möbius committed
35
36
37
endif()


David Bommes's avatar
changed    
David Bommes committed
38
39
40
41
find_path(METIS_INCLUDE_DIR NAMES metis.h
     PATHS "$ENV{IPOPT_HOME}/ThirdParty/Metis/metis-4.0/Lib/"
           "/usr/include/"
           "/usr/include/metis"
Jan Möbius's avatar
Jan Möbius committed
42
43
           "/opt/local/include"
           "/opt/local/include/metis"
Jan Möbius's avatar
Jan Möbius committed
44
           "${VS_SEARCH_PATH}Ipopt-3.12.4/Ipopt/MSVisualStudio/v8-ifort/installed/include/metis"
David Bommes's avatar
changed    
David Bommes committed
45
46
   )
   
Jan Möbius's avatar
Jan Möbius committed
47
find_library( METIS_LIBRARY_RELEASE
David Bommes's avatar
changed    
David Bommes committed
48
49
              metis coinmetis
              PATHS "$ENV{IPOPT_HOME}/lib/"
Jan Möbius's avatar
Jan Möbius committed
50
                    "/usr/lib"
Jan Möbius's avatar
Jan Möbius committed
51
                    "/opt/local/lib"
Jan Möbius's avatar
Jan Möbius committed
52
                    "${VS_SEARCH_PATH}Ipopt-3.12.4/Ipopt/MSVisualStudio/v8-ifort/installed/lib"
Jan Möbius's avatar
Jan Möbius committed
53
54
55
56
57
58
59
                    )
                    
find_library( METIS_LIBRARY_DEBUG
              metisd coinmetisd
              PATHS "$ENV{IPOPT_HOME}/lib/"
                    "/usr/lib"
                    "/opt/local/lib" 
Jan Möbius's avatar
Jan Möbius committed
60
                    "${VS_SEARCH_PATH}Ipopt-3.12.4/Ipopt/MSVisualStudio/v8-ifort/installed/lib"
Jan Möbius's avatar
Jan Möbius committed
61
62
63
64
                    )      
                    
include(SelectLibraryConfigurations)
select_library_configurations( METIS )                   
David Bommes's avatar
changed    
David Bommes committed
65
66
67
68
69
70
71
72
73
74

set(METIS_INCLUDE_DIRS "${METIS_INCLUDE_DIR}" )
set(METIS_LIBRARIES "${METIS_LIBRARY}" )

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBCPLEX_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(METIS  DEFAULT_MSG
                                  METIS_LIBRARY METIS_INCLUDE_DIR)

Jan Möbius's avatar
Jan Möbius committed
75
mark_as_advanced(METIS_INCLUDE_DIR METIS_LIBRARY )