test/CMakeLists.txt
author Akos Ladanyi <ladanyi@tmit.bme.hu>
Tue, 28 Apr 2009 11:55:43 +0100
changeset 636 6dc44006c1a8
parent 621 b536eaacb39b
parent 499 d8ca76573eb3
child 649 76cbcb3e9bbb
permissions -rw-r--r--
Link libm and libpthread if using CPLEX (#277)
ladanyi@499
     1
INCLUDE_DIRECTORIES(
ladanyi@549
     2
  ${PROJECT_SOURCE_DIR}
ladanyi@499
     3
  ${PROJECT_BINARY_DIR}
ladanyi@499
     4
)
ladanyi@141
     5
ladanyi@549
     6
LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon)
ladanyi@141
     7
alpar@225
     8
SET(TESTS
deba@512
     9
  adaptors_test
ladanyi@141
    10
  bfs_test
alpar@424
    11
  circulation_test
ladanyi@141
    12
  counter_test
ladanyi@141
    13
  dfs_test
ladanyi@141
    14
  digraph_test
kpeter@170
    15
  dijkstra_test
ladanyi@141
    16
  dim_test
deba@512
    17
  edge_set_test
ladanyi@141
    18
  error_test
ladanyi@522
    19
  euler_test
tapolcai@543
    20
  gomory_hu_test
deba@200
    21
  graph_copy_test
ladanyi@141
    22
  graph_test
kpeter@171
    23
  graph_utils_test
deba@410
    24
  hao_orlin_test
deba@203
    25
  heap_test
ladanyi@141
    26
  kruskal_test
ladanyi@141
    27
  maps_test
kpeter@594
    28
  matching_test
deba@490
    29
  min_cost_arborescence_test
kpeter@601
    30
  min_cost_flow_test
alpar@424
    31
  path_test
alpar@424
    32
  preflow_test
ladanyi@473
    33
  radix_sort_test
alpar@225
    34
  random_test
alpar@424
    35
  suurballe_test
ladanyi@141
    36
  time_measure_test
ladanyi@141
    37
  unionfind_test)
ladanyi@141
    38
ladanyi@627
    39
IF(LEMON_HAVE_LP)
ladanyi@473
    40
  ADD_EXECUTABLE(lp_test lp_test.cc)
ladanyi@620
    41
  SET(LP_TEST_LIBS lemon)
ladanyi@627
    42
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    43
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@627
    44
  ENDIF(LEMON_HAVE_GLPK)
ladanyi@627
    45
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
    46
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@627
    47
  ENDIF(LEMON_HAVE_CPLEX)
ladanyi@627
    48
  IF(LEMON_HAVE_CLP)
ladanyi@621
    49
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@627
    50
  ENDIF(LEMON_HAVE_CLP)
ladanyi@620
    51
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    52
  ADD_TEST(lp_test lp_test)
ladanyi@473
    53
ladanyi@627
    54
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
    55
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@473
    56
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    57
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@473
    58
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@473
    59
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@473
    60
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    61
    )
ladanyi@627
    62
  ENDIF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@627
    63
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
    64
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@620
    65
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    66
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@620
    67
      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
    68
    )
ladanyi@627
    69
  ENDIF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@627
    70
ENDIF(LEMON_HAVE_LP)
ladanyi@473
    71
ladanyi@627
    72
IF(LEMON_HAVE_MIP)
ladanyi@473
    73
  ADD_EXECUTABLE(mip_test mip_test.cc)
ladanyi@620
    74
  SET(MIP_TEST_LIBS lemon)
ladanyi@627
    75
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    76
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@627
    77
  ENDIF(LEMON_HAVE_GLPK)
ladanyi@627
    78
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
    79
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@627
    80
  ENDIF(LEMON_HAVE_CPLEX)
ladanyi@627
    81
  IF(LEMON_HAVE_CBC)
ladanyi@621
    82
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@627
    83
  ENDIF(LEMON_HAVE_CBC)
ladanyi@620
    84
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
    85
  ADD_TEST(mip_test mip_test)
ladanyi@473
    86
ladanyi@627
    87
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
    88
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@473
    89
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    90
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@473
    91
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@473
    92
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@473
    93
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    94
    )
ladanyi@627
    95
  ENDIF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@627
    96
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
    97
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@620
    98
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    99
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@620
   100
      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
   101
    )
ladanyi@627
   102
  ENDIF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@627
   103
ENDIF(LEMON_HAVE_MIP)
ladanyi@473
   104
alpar@225
   105
FOREACH(TEST_NAME ${TESTS})
alpar@225
   106
  ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@225
   107
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@225
   108
  ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@225
   109
ENDFOREACH(TEST_NAME)