FindCBC.cmake 2.05 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
          )

find_library( CBC_LIBRARY 
35
              NAMES Cbc libCbc
David Bommes's avatar
David Bommes committed
36
37
38
39
              PATHS "$ENV{CBC_DIR}/lib" 
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\cbc\\lib"
40
					"${VS_SEARCH_PATH}CBC-2.9.4/Cbc/lib"
David Bommes's avatar
David Bommes committed
41
42
43
              )

find_library( CBC_SOLVER_LIBRARY 
44
              NAMES CbcSolver libCbcSolver
David Bommes's avatar
David Bommes committed
45
46
47
48
49

              PATHS "$ENV{CBC_DIR}/lib" 
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\cbc\\lib"
50
					"${VS_SEARCH_PATH}CBC-2.9.4/Cbc/lib"
David Bommes's avatar
David Bommes committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
              )

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)