FindGUROBI.cmake 2.09 KB
Newer Older
David Bommes's avatar
David Bommes committed
1
2
3
4
5
6
# - Try to find GUROBI
# Once done this will define
#  GUROBI_FOUND - System has Gurobi
#  GUROBI_INCLUDE_DIRS - The Gurobi include directories
#  GUROBI_LIBRARIES - The libraries needed to use Gurobi

David Bommes's avatar
David Bommes committed
7
8
9
if (GUROBI_INCLUDE_DIR)
  # in cache already
  set(GUROBI_FOUND TRUE)
David Bommes's avatar
David Bommes committed
10
11
  set(GUROBI_INCLUDE_DIRS "${GUROBI_INCLUDE_DIR}" )
  set(GUROBI_LIBRARIES "${GUROBI_LIBRARY};${GUROBI_CXX_LIBRARY}" )
David Bommes's avatar
David Bommes committed
12
13
else (GUROBI_INCLUDE_DIR)

David Bommes's avatar
David Bommes committed
14
15
16
17
find_path(GUROBI_INCLUDE_DIR 
          NAMES gurobi_c++.h
          PATHS "$ENV{GUROBI_HOME}/include"
                  "/Library/gurobi502/mac64/include"
18
                  "/Library/gurobi562/mac64/include"
David Bommes's avatar
David Bommes committed
19
                 "C:\\libs\\gurobi502\\include"
20
                 "C:\\libs\\gurobi562\\include"
David Bommes's avatar
David Bommes committed
21
22
23
24
          )

find_library( GUROBI_LIBRARY 
              NAMES gurobi
25
26
27
                    gurobi56
                    gurobi55
                    gurobi51
David Bommes's avatar
David Bommes committed
28
                    gurobi50 
29
30
31
        		    gurobi46
				    gurobi45

David Bommes's avatar
David Bommes committed
32
              PATHS "$ENV{GUROBI_HOME}/lib" 
33
                    "/Library/gurobi562/mac64/lib"
David Bommes's avatar
David Bommes committed
34
                    "/Library/gurobi502/mac64/lib"
35
                    "C:\\libs\\gurobi562\\lib"
David Bommes's avatar
David Bommes committed
36
37
38
39
40
41
                    "C:\\libs\\gurobi502\\lib"
              )

find_library( GUROBI_CXX_LIBRARY 
              NAMES gurobi_c++
              PATHS "$ENV{GUROBI_HOME}/lib" 
42
                    "/Library/gurobi562/mac64/lib"
David Bommes's avatar
David Bommes committed
43
                    "/Library/gurobi502/mac64/lib"
44
                    "C:\\libs\\gurobi562\\lib"
David Bommes's avatar
David Bommes committed
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
                    "C:\\libs\\gurobi502\\lib"
              )

set(GUROBI_INCLUDE_DIRS "${GUROBI_INCLUDE_DIR}" )
set(GUROBI_LIBRARIES "${GUROBI_LIBRARY};${GUROBI_CXX_LIBRARY}" )

# use c++ headers as default
# set(GUROBI_COMPILER_FLAGS "-DIL_STD" CACHE STRING "Gurobi Compiler Flags")

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(GUROBI  DEFAULT_MSG
                                  GUROBI_LIBRARY GUROBI_CXX_LIBRARY GUROBI_INCLUDE_DIR)

mark_as_advanced(GUROBI_INCLUDE_DIR GUROBI_LIBRARY GUROBI_CXX_LIBRARY)
David Bommes's avatar
David Bommes committed
61

62
endif(GUROBI_INCLUDE_DIR)