gravatar
ladanyi@tmit.bme.hu
ladanyi@tmit.bme.hu
FindCPLEX for CMake (#256)
0 4 1
default
5 files changed with 60 insertions and 2 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
1
FIND_PATH(CPLEX_INCLUDE_DIR
2
  ilcplex/cplex.h
3
  PATHS "C:/ILOG/CPLEX91/include")
4

	
5
FIND_LIBRARY(CPLEX_LIBRARY
6
  NAMES cplex91
7
  PATHS "C:/ILOG/CPLEX91/lib/msvc7/stat_mda")
8

	
9
INCLUDE(FindPackageHandleStandardArgs)
10
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPLEX DEFAULT_MSG CPLEX_LIBRARY CPLEX_INCLUDE_DIR)
11

	
12
FIND_PATH(CPLEX_BIN_DIR
13
  cplex91.dll
14
  PATHS "C:/ILOG/CPLEX91/bin/x86_win32")
15

	
16
IF(CPLEX_FOUND)
17
  SET(CPLEX_INCLUDE_DIRS ${CPLEX_INCLUDE_DIR})
18
  SET(CPLEX_LIBRARIES ${CPLEX_LIBRARY})
19
ENDIF(CPLEX_FOUND)
20

	
21
MARK_AS_ADVANCED(CPLEX_LIBRARY CPLEX_INCLUDE_DIR CPLEX_BIN_DIR)
22

	
23
IF(CPLEX_FOUND)
24
  SET(HAVE_LP TRUE)
25
  SET(HAVE_MIP TRUE)
26
  SET(HAVE_CPLEX TRUE)
27
ENDIF(CPLEX_FOUND)
Ignore white space 6 line context
... ...
@@ -16,2 +16,3 @@
16 16
FIND_PACKAGE(GLPK 4.33)
17
FIND_PACKAGE(CPLEX)
17 18

	
Show white space 6 line context
... ...
@@ -30,2 +30,7 @@
30 30

	
31
IF(HAVE_CPLEX)
32
  SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc)
33
  INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS})
34
ENDIF(HAVE_CPLEX)
35

	
31 36
ADD_LIBRARY(lemon ${LEMON_SOURCES})
Ignore white space 6 line context
... ...
@@ -4,1 +4,2 @@
4 4
#cmakedefine HAVE_GLPK 1
5
#cmakedefine HAVE_CPLEX 1
Ignore white space 6 line context
... ...
@@ -40,5 +40,10 @@
40 40
  ADD_EXECUTABLE(lp_test lp_test.cc)
41
  SET(LP_TEST_LIBS lemon)
41 42
  IF(HAVE_GLPK)
42
    TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
43
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
43 44
  ENDIF(HAVE_GLPK)
45
  IF(HAVE_CPLEX)
46
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
47
  ENDIF(HAVE_CPLEX)
48
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
44 49
  ADD_TEST(lp_test lp_test)
... ...
@@ -54,2 +59,9 @@
54 59
  ENDIF(WIN32 AND HAVE_GLPK)
60
  IF(WIN32 AND HAVE_CPLEX)
61
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
62
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
63
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
64
      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
65
    )
66
  ENDIF(WIN32 AND HAVE_CPLEX)
55 67
ENDIF(HAVE_LP)
... ...
@@ -58,5 +70,10 @@
58 70
  ADD_EXECUTABLE(mip_test mip_test.cc)
71
  SET(MIP_TEST_LIBS lemon)
59 72
  IF(HAVE_GLPK)
60
    TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES})
73
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
61 74
  ENDIF(HAVE_GLPK)
75
  IF(HAVE_CPLEX)
76
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
77
  ENDIF(HAVE_CPLEX)
78
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
62 79
  ADD_TEST(mip_test mip_test)
... ...
@@ -72,2 +89,9 @@
72 89
  ENDIF(WIN32 AND HAVE_GLPK)
90
  IF(WIN32 AND HAVE_CPLEX)
91
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
92
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
93
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
94
      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
95
    )
96
  ENDIF(WIN32 AND HAVE_CPLEX)
73 97
ENDIF(HAVE_MIP)
0 comments (0 inline)