FindMUMPS.cmake 2.89 KB
Newer Older
David Bommes's avatar
changed    
David Bommes committed
1
2
3
4
5
6
7
# - Try to find MUMPS
# Once done this will define
#  MUMPS_FOUND - System has Mumps
#  MUMPS_INCLUDE_DIRS - The Mumps include directories
#  MUMPS_LIBRARY_DIRS - The library directories needed to use Mumps
#  MUMPS_LIBRARIES    - The libraries needed to use Mumps

David Bommes's avatar
David Bommes committed
8
9
10
11
12
if (MUMPS_INCLUDE_DIR)
  # in cache already
  SET(MUMPS_FIND_QUIETLY TRUE)
endif (MUMPS_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()

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/")
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/")
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/")
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/")
35
36
endif()

David Bommes's avatar
changed    
David Bommes committed
37
38
39
find_path(MUMPS_INCLUDE_DIR NAMES dmumps_c.h
     PATHS "$ENV{IPOPT_HOME}/ThirdParty/Mumps/MUMPS/include/"
           "/usr/include/"
Jan Möbius's avatar
Jan Möbius committed
40
           "${VS_SEARCH_PATH}Ipopt-3.12.4/Ipopt/MSVisualStudio/v8-ifort/installed/include/mumps/include/"
David Bommes's avatar
David Bommes committed
41
   )
David Bommes's avatar
changed    
David Bommes committed
42
   
43
44
45
46
find_library( MUMPS_LIBRARY_DEBUG
              dmumpsd coinmumpsd coinmumpscd
              PATHS "$ENV{IPOPT_HOME}/lib/"
                    "/usr/lib"
Jan Möbius's avatar
Jan Möbius committed
47
                    "${VS_SEARCH_PATH}Ipopt-3.12.4/Ipopt/MSVisualStudio/v8-ifort/installed/lib"
48
49
50
51
                    )
                    
find_library( MUMPS_LIBRARY_RELEASE
              dmumps coinmumps coinmumpsc
David Bommes's avatar
changed    
David Bommes committed
52
              PATHS "$ENV{IPOPT_HOME}/lib/"
53
                    "/usr/lib"
Jan Möbius's avatar
Jan Möbius committed
54
                    "${VS_SEARCH_PATH}Ipopt-3.12.4/Ipopt/MSVisualStudio/v8-ifort/installed/lib"
55
                    )                    
David Bommes's avatar
changed    
David Bommes committed
56

57
58
59
include(SelectLibraryConfigurations)
select_library_configurations( MUMPS )                 
                    
David Bommes's avatar
changed    
David Bommes committed
60
61
set(MUMPS_INCLUDE_DIRS "${MUMPS_INCLUDE_DIR}" )
set(MUMPS_LIBRARIES "${MUMPS_LIBRARY}" )
David Bommes's avatar
David Bommes committed
62

David Bommes's avatar
changed    
David Bommes committed
63
64
65
66
67
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(MUMPS  DEFAULT_MSG
                                  MUMPS_LIBRARY MUMPS_INCLUDE_DIR)
David Bommes's avatar
David Bommes committed
68

69
mark_as_advanced(MUMPS_INCLUDE_DIR MUMPS_LIBRARY )