FindOSI.cmake 2.71 KB
Newer Older
David Bommes's avatar
David Bommes committed
1
2
3
4
5
6
# - Try to find OSI
# Once done this will define
#  OSI_FOUND - System has OSI
#  OSI_INCLUDE_DIRS - The OSI include directories
#  OSI_LIBRARIES - The libraries needed to use OSI

Jan Möbius's avatar
Jan Möbius committed
7
8
9
10
11
12
13
14
15
16
17
18
# I8 Search paths for windows libraries
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*Win64" )
  SET(VS_SEARCH_PATH "c:/libs/vs2012/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
  SET(VS_SEARCH_PATH "c:/libs/vs2012/x32/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*Win64" )
  SET(VS_SEARCH_PATH "c:/libs/vs2013/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*" )
  SET(VS_SEARCH_PATH "c:/libs/vs2013/x32/")
endif()


David Bommes's avatar
David Bommes committed
19
20
21
22
23
24
25
26
27
if (OSI_INCLUDE_DIR)
  # in cache already
  set(OSI_FOUND TRUE)
  set(OSI_INCLUDE_DIRS "${OSI_INCLUDE_DIR}" )
  set(OSI_LIBRARIES "${OSI_LIBRARY};${OSI_CBC_LIBRARY};${OSI_CLP_LIBRARY}" )
else (OSI_INCLUDE_DIR)

find_path(OSI_INCLUDE_DIR 
          NAMES OsiConfig.h
Jan Möbius's avatar
Jan Möbius committed
28
		  PATH_SUFFIXES "Osi"
David Bommes's avatar
David Bommes committed
29
30
31
32
33
          PATHS "$ENV{OSI_DIR}/include/coin"
                "$ENV{CBC_DIR}/include/coin"
                 "/usr/include/coin"
                 "C:\\libs\\osi\\include"
                 "C:\\libs\\cbc\\include"
34
				 "${VS_SEARCH_PATH}CBC-2.9.4/Osi/include"
David Bommes's avatar
David Bommes committed
35
36
37
          )

find_library( OSI_LIBRARY 
38
              NAMES Osi libOsi
David Bommes's avatar
David Bommes committed
39
40
41
42
43
44
              PATHS "$ENV{OSI_DIR}/lib"
                    "$ENV{CBC_DIR}/lib" 
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\OSI\\lib"
                    "C:\\libs\\cbc\\lib"
45
					"${VS_SEARCH_PATH}CBC-2.9.4/Osi/lib"
David Bommes's avatar
David Bommes committed
46
47
48
              )

find_library( OSI_CBC_LIBRARY 
49
              NAMES OsiCbc libOsiCbc
David Bommes's avatar
David Bommes committed
50
51
52
53
54
55
              PATHS "$ENV{OSI_DIR}/lib"
                    "$ENV{CBC_DIR}/lib" 
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\OSI\\lib"
                    "C:\\libs\\cbc\\lib"
56
					"${VS_SEARCH_PATH}CBC-2.9.4/Osi/lib"
David Bommes's avatar
David Bommes committed
57
58
59
              )

find_library( OSI_CLP_LIBRARY 
60
              NAMES OsiClp libOsiClp
David Bommes's avatar
David Bommes committed
61
62
63
64
65
66
              PATHS "$ENV{OSI_DIR}/lib"
                    "$ENV{CBC_DIR}/lib" 
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\OSI\\lib"
                    "C:\\libs\\cbc\\lib"
67
					"${VS_SEARCH_PATH}CBC-2.9.4/Osi/lib"
David Bommes's avatar
David Bommes committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
              )

set(OSI_INCLUDE_DIRS "${OSI_INCLUDE_DIR}" )
set(OSI_LIBRARIES "${OSI_LIBRARY};${OSI_CBC_LIBRARY};${OSI_CLP_LIBRARY}" )


include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set OSI_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(OSI  DEFAULT_MSG
                                  OSI_LIBRARY OSI_CBC_LIBRARY OSI_CLP_LIBRARY OSI_INCLUDE_DIR)

mark_as_advanced(OSI_INCLUDE_DIR OSI_LIBRARY OSI_CBC_LIBRARY OSI_CLP_LIBRARY)

endif(OSI_INCLUDE_DIR)