FindCLP.cmake 2.92 KB
Newer Older
David Bommes's avatar
David Bommes committed
1
2
3
4
5
6
# - Try to find CLP
# Once done this will define
#  CLP_FOUND - System has CLP
#  CLP_INCLUDE_DIRS - The CLP include directories
#  CLP_LIBRARIES - The libraries needed to use CLP

Matthias Möller's avatar
Matthias Möller committed
7

8
9
10
11
12

# 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." )
Jan Möbius's avatar
Jan Möbius committed
13
endif()
14

Matthias Möller's avatar
Matthias Möller committed
15
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*Win64" )
16
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x64/")
Matthias Möller's avatar
Matthias Möller committed
17
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
18
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x32/")
Matthias Möller's avatar
Matthias Möller committed
19
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*Win64" )
20
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x64/")
Matthias Möller's avatar
Matthias Möller committed
21
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*" )
22
23
24
25
26
  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/")
Matthias Möller's avatar
Matthias Möller committed
27
28
endif()

29
if (NOT CLP_FOUND)
David Bommes's avatar
David Bommes committed
30
31
32
33
34
35
36
37

find_path(CLP_INCLUDE_DIR 
          NAMES ClpConfig.h
          PATHS "$ENV{CLP_DIR}/include/coin"
                "$ENV{CBC_DIR}/include/coin"
                 "/usr/include/coin"
                 "C:\\libs\\clp\\include"
                 "C:\\libs\\cbc\\include"
38
39
40
                 "${VS_SEARCH_PATH}CBC-2.9.7/Clp/include"
                 "${VS_SEARCH_PATH}CBC-2.9.4/Clp/include"
              )
David Bommes's avatar
David Bommes committed
41

42
43
find_library( CLP_LIBRARY_DEBUG
              NAMES Clpd libClpd
David Bommes's avatar
David Bommes committed
44
45
46
47
48
49
              PATHS "$ENV{CLP_DIR}/lib"
                    "$ENV{CBC_DIR}/lib" 
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\clp\\lib"
                    "C:\\libs\\cbc\\lib"
50
51
                    "${VS_SEARCH_PATH}CBC-2.9.7/lib/${VS_SUBDIR}Debug"
                    "${VS_SEARCH_PATH}CBC-2.9.4/Clp/lib"
David Bommes's avatar
David Bommes committed
52
              )
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
              
find_library( CLP_LIBRARY_RELEASE
              NAMES Clp libClp
              PATHS "$ENV{CLP_DIR}/lib"
                    "$ENV{CBC_DIR}/lib" 
                    "/usr/lib"
                    "/usr/lib/coin"
                    "C:\\libs\\clp\\lib"
                    "C:\\libs\\cbc\\lib"
                    "${VS_SEARCH_PATH}CBC-2.9.7/lib/${VS_SUBDIR}Release"
                    "${VS_SEARCH_PATH}CBC-2.9.4/Clp/lib"
              )              

include(SelectLibraryConfigurations)
select_library_configurations( CLP )
David Bommes's avatar
David Bommes committed
68
69
70
71
72
73
74
75
76
77
78
79
80

set(CLP_INCLUDE_DIRS "${CLP_INCLUDE_DIR}" )
set(CLP_LIBRARIES "${CLP_LIBRARY}" )


include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set CLP_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(CLP  DEFAULT_MSG
                                  CLP_LIBRARY CLP_INCLUDE_DIR)

mark_as_advanced(CLP_INCLUDE_DIR CLP_LIBRARY)

81
endif(CLP_FOUND)