FindCBC.cmake 2.89 KB
Newer Older
David Bommes's avatar
David Bommes committed
1
2
3
4
5
6
# - Try to find CBC
# Once done this will define
#  CBC_FOUND - System has CBC
#  CBC_INCLUDE_DIRS - The CBC include directories
#  CBC_LIBRARIES - The libraries needed to use CBC

Jan Möbius's avatar
Jan Möbius committed
7
8
9
10
11
12
13
14
15
16
17
# 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
18
19
20
21
22
23
24
if (CBC_INCLUDE_DIR)
  # in cache already
  set(CBC_FOUND TRUE)
  set(CBC_INCLUDE_DIRS "${CBC_INCLUDE_DIR}" )
  set(CBC_LIBRARIES "${CBC_LIBRARY};${CBC_SOLVER_LIBRARY}" )
else (CBC_INCLUDE_DIR)

25

David Bommes's avatar
David Bommes committed
26
27
28
29
30
find_path(CBC_INCLUDE_DIR 
          NAMES CbcConfig.h
          PATHS "$ENV{CBC_DIR}/include/coin"
                 "/usr/include/coin"
                 "C:\\libs\\cbc\\include"
31
				 "${VS_SEARCH_PATH}CBC-2.9.4/Cbc/include"
David Bommes's avatar
David Bommes committed
32
33
          )

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
find_library( CBC_LIBRARY_DEBUG
              NAMES Cbcd libCbcd
              PATHS "$ENV{CBC_DIR}/lib"
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\cbc\\lib"
                                        "${VS_SEARCH_PATH}CBC-2.9.4/Cbc/lib"
              )

find_library( CBC_SOLVER_LIBRARY_DEBUG
              NAMES CbcSolverd libCbcSolverd

              PATHS "$ENV{CBC_DIR}/lib"
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\cbc\\lib"
                                        "${VS_SEARCH_PATH}CBC-2.9.4/Cbc/lib"
              )

find_library( CBC_LIBRARY_RELEASE
54
              NAMES Cbc libCbc
55
              PATHS "$ENV{CBC_DIR}/lib"
David Bommes's avatar
David Bommes committed
56
57
58
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\cbc\\lib"
59
                                        "${VS_SEARCH_PATH}CBC-2.9.4/Cbc/lib"
David Bommes's avatar
David Bommes committed
60
61
              )

62
find_library( CBC_SOLVER_LIBRARY_RELEASE
63
              NAMES CbcSolver libCbcSolver
David Bommes's avatar
David Bommes committed
64

65
              PATHS "$ENV{CBC_DIR}/lib"
David Bommes's avatar
David Bommes committed
66
67
68
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\cbc\\lib"
69
                                        "${VS_SEARCH_PATH}CBC-2.9.4/Cbc/lib"
David Bommes's avatar
David Bommes committed
70
71
              )

72
73
74
75
76

  include(SelectLibraryConfigurations)
  select_library_configurations( CBC_LIBRARY )
  select_library_configurations( CBC_SOLVER_LIBRARY )

David Bommes's avatar
David Bommes committed
77
78
79
80
81
82
83
84
85
86
87
88
89
set(CBC_INCLUDE_DIRS "${CBC_INCLUDE_DIR}" )
set(CBC_LIBRARIES "${CBC_LIBRARY};${CBC_SOLVER_LIBRARY}" )


include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set CBC_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(CBC  DEFAULT_MSG
                                  CBC_LIBRARY CBC_SOLVER_LIBRARY CBC_INCLUDE_DIR)

mark_as_advanced(CBC_INCLUDE_DIR CBC_LIBRARY CBC_SOLVER_LIBRARY)

endif(CBC_INCLUDE_DIR)