test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Tue, 12 Apr 2011 07:52:25 +0200
branch1.2
changeset 914 60f4aaedb20f
parent 905 d149eaf24638
parent 911 66156a3498ea
child 921 b522385b2a0d
permissions -rw-r--r--
Merge #418 to branch 1.2
ladanyi@499
     1
INCLUDE_DIRECTORIES(
ladanyi@549
     2
  ${PROJECT_SOURCE_DIR}
ladanyi@499
     3
  ${PROJECT_BINARY_DIR}
ladanyi@499
     4
)
ladanyi@141
     5
ladanyi@679
     6
LINK_DIRECTORIES(
ladanyi@679
     7
  ${PROJECT_BINARY_DIR}/lemon
ladanyi@679
     8
)
ladanyi@141
     9
alpar@911
    10
SET(TEST_WITH_VALGRIND "NO" CACHE STRING
alpar@911
    11
  "Run the test with valgrind (YES/NO).")
alpar@911
    12
SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.")
alpar@911
    13
alpar@225
    14
SET(TESTS
deba@512
    15
  adaptors_test
kpeter@698
    16
  bellman_ford_test
ladanyi@141
    17
  bfs_test
alpar@424
    18
  circulation_test
kpeter@649
    19
  connectivity_test
ladanyi@141
    20
  counter_test
ladanyi@141
    21
  dfs_test
ladanyi@141
    22
  digraph_test
kpeter@170
    23
  dijkstra_test
ladanyi@141
    24
  dim_test
deba@512
    25
  edge_set_test
ladanyi@141
    26
  error_test
ladanyi@522
    27
  euler_test
deba@869
    28
  fractional_matching_test
tapolcai@543
    29
  gomory_hu_test
deba@200
    30
  graph_copy_test
ladanyi@141
    31
  graph_test
kpeter@171
    32
  graph_utils_test
deba@410
    33
  hao_orlin_test
deba@203
    34
  heap_test
ladanyi@141
    35
  kruskal_test
ladanyi@141
    36
  maps_test
kpeter@594
    37
  matching_test
deba@490
    38
  min_cost_arborescence_test
kpeter@601
    39
  min_cost_flow_test
kpeter@763
    40
  min_mean_cycle_test
alpar@424
    41
  path_test
deba@797
    42
  planarity_test
alpar@424
    43
  preflow_test
ladanyi@473
    44
  radix_sort_test
alpar@225
    45
  random_test
alpar@424
    46
  suurballe_test
ladanyi@141
    47
  time_measure_test
ladanyi@679
    48
  unionfind_test
ladanyi@679
    49
)
ladanyi@141
    50
ladanyi@627
    51
IF(LEMON_HAVE_LP)
alpar@904
    52
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@904
    53
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@904
    54
  ELSE()
alpar@904
    55
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@904
    56
  ENDIF()
alpar@904
    57
ladanyi@620
    58
  SET(LP_TEST_LIBS lemon)
ladanyi@679
    59
ladanyi@627
    60
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    61
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
    62
  ENDIF()
ladanyi@627
    63
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
    64
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
    65
  ENDIF()
ladanyi@627
    66
  IF(LEMON_HAVE_CLP)
ladanyi@621
    67
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@679
    68
  ENDIF()
ladanyi@679
    69
ladanyi@620
    70
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    71
  ADD_TEST(lp_test lp_test)
ladanyi@473
    72
ladanyi@627
    73
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
    74
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@473
    75
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    76
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    77
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
    78
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
    79
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    80
    )
ladanyi@679
    81
  ENDIF()
ladanyi@679
    82
ladanyi@627
    83
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
    84
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@620
    85
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    86
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    87
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
    88
    )
ladanyi@679
    89
  ENDIF()
ladanyi@679
    90
ENDIF()
ladanyi@473
    91
ladanyi@627
    92
IF(LEMON_HAVE_MIP)
alpar@904
    93
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@904
    94
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@904
    95
  ELSE()
alpar@904
    96
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@904
    97
  ENDIF()
alpar@904
    98
ladanyi@620
    99
  SET(MIP_TEST_LIBS lemon)
ladanyi@679
   100
ladanyi@627
   101
  IF(LEMON_HAVE_GLPK)
ladanyi@620
   102
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
   103
  ENDIF()
ladanyi@627
   104
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
   105
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
   106
  ENDIF()
ladanyi@627
   107
  IF(LEMON_HAVE_CBC)
ladanyi@621
   108
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@679
   109
  ENDIF()
ladanyi@679
   110
ladanyi@620
   111
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
   112
  ADD_TEST(mip_test mip_test)
ladanyi@473
   113
ladanyi@627
   114
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
   115
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@473
   116
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
   117
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   118
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
   119
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
   120
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
   121
    )
ladanyi@679
   122
  ENDIF()
ladanyi@679
   123
ladanyi@627
   124
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
   125
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@620
   126
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
   127
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   128
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
   129
    )
ladanyi@679
   130
  ENDIF()
ladanyi@679
   131
ENDIF()
ladanyi@473
   132
alpar@225
   133
FOREACH(TEST_NAME ${TESTS})
alpar@904
   134
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@904
   135
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@904
   136
  ELSE()
alpar@904
   137
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@904
   138
  ENDIF()
alpar@225
   139
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@911
   140
    IF(TEST_WITH_VALGRIND)
alpar@911
   141
      ADD_TEST(${TEST_NAME}
alpar@911
   142
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@911
   143
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@911
   144
    ELSE()
alpar@911
   145
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@911
   146
    ENDIF()
alpar@904
   147
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@679
   148
ENDFOREACH()