FindCPLEX.cmake 1.99 KB
Newer Older
David Bommes's avatar
changed  
David Bommes committed
1
2
3
4
5
6
7
8
9
# - Try to find CPLEX
# Once done this will define
#  CPLEX_FOUND - System has Cplex
#  CPLEX_INCLUDE_DIRS - The Cplex include directories
#  CPLEX_LIBRARIES - The libraries needed to use Cplex

if (CPLEX_INCLUDE_DIR)
  # in cache already
  set(CPLEX_FOUND TRUE)
10
11
  set(CPLEX_INCLUDE_DIRS "${CPLEX_INCLUDE_DIR};${CPLEX_CONCERT_INCLUDE_DIR}" )
  set(CPLEX_LIBRARIES "${CPLEX_LIBRARY};${CPLEX_ILO_LIBRARY};${CPLEX_CONCERT_LIBRARY}" )
David Bommes's avatar
changed  
David Bommes committed
12
13
else (CPLEX_INCLUDE_DIR)

14
15
16
17
18
19
20
21
22
23
24
25
26
find_path(CPLEX_INCLUDE_DIR 
          NAMES ilcplex/cplex.h
          PATHS "$ENV{CPLEX_DIR}/cplex/include"
          )
          
find_path(CPLEX_CONCERT_INCLUDE_DIR 
          NAMES ilconcert/ilomodel.h
          PATHS "$ENV{CPLEX_DIR}/concert/include"
          )

find_library( CPLEX_LIBRARY 
              cplex
              PATHS "$ENV{CPLEX_DIR}/cplex/lib/x86-64_sles10_4.1/static_pic" 
David Bommes's avatar
David Bommes committed
27
                    "$ENV{CPLEX_DIR}/cplex/lib/x86-64_darwin/static_pic/"
28
29
30
31
32
              )

find_library( CPLEX_ILO_LIBRARY 
              ilocplex
              PATHS "$ENV{CPLEX_DIR}/cplex/lib/x86-64_sles10_4.1/static_pic" 
David Bommes's avatar
David Bommes committed
33
                    "$ENV{CPLEX_DIR}/cplex/lib/x86-64_darwin/static_pic/"
34
35
36
37
38
              )

find_library( CPLEX_CONCERT_LIBRARY 
              concert
              PATHS "$ENV{CPLEX_DIR}/concert/lib/x86-64_sles10_4.1/static_pic" 
David Bommes's avatar
David Bommes committed
39
                    "$ENV{CPLEX_DIR}/concert/lib/x86-64_darwin/static_pic/"
40
41
              )     
                 
David Bommes's avatar
changed  
David Bommes committed
42
43
44
45

set(CPLEX_INCLUDE_DIRS "${CPLEX_INCLUDE_DIR};${CPLEX_CONCERT_INCLUDE_DIR}" )
set(CPLEX_LIBRARIES "${CPLEX_LIBRARY};${CPLEX_ILO_LIBRARY};${CPLEX_CONCERT_LIBRARY}" )

46
47
48
# use c++ headers as default
set(CPLEX_COMPILER_FLAGS "-DIL_STD" CACHE STRING "Cplex Compiler Flags")

David Bommes's avatar
changed  
David Bommes committed
49
50
51
52
53
54
55
56
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(CPLEX  DEFAULT_MSG
                                  CPLEX_LIBRARY CPLEX_INCLUDE_DIR)

mark_as_advanced(CPLEX_INCLUDE_DIR CPLEX_LIBRARY )

David Bommes's avatar
David Bommes committed
57
endif(CPLEX_INCLUDE_DIR)