test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Thu, 07 Apr 2011 16:57:35 +0200
changeset 913 64260c0f58eb
parent 679 9c7639f3a741
child 905 d149eaf24638
child 911 66156a3498ea
permissions -rw-r--r--
Better Win CodeBlock/MinGW support (#418)
- Remove -ansi compilation flag
- Don't include sys/times.h when WIN32 is defined
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@225
    10
SET(TESTS
deba@512
    11
  adaptors_test
ladanyi@141
    12
  bfs_test
alpar@424
    13
  circulation_test
kpeter@649
    14
  connectivity_test
ladanyi@141
    15
  counter_test
ladanyi@141
    16
  dfs_test
ladanyi@141
    17
  digraph_test
kpeter@170
    18
  dijkstra_test
ladanyi@141
    19
  dim_test
deba@512
    20
  edge_set_test
ladanyi@141
    21
  error_test
ladanyi@522
    22
  euler_test
tapolcai@543
    23
  gomory_hu_test
deba@200
    24
  graph_copy_test
ladanyi@141
    25
  graph_test
kpeter@171
    26
  graph_utils_test
deba@410
    27
  hao_orlin_test
deba@203
    28
  heap_test
ladanyi@141
    29
  kruskal_test
ladanyi@141
    30
  maps_test
kpeter@594
    31
  matching_test
deba@490
    32
  min_cost_arborescence_test
kpeter@601
    33
  min_cost_flow_test
alpar@424
    34
  path_test
alpar@424
    35
  preflow_test
ladanyi@473
    36
  radix_sort_test
alpar@225
    37
  random_test
alpar@424
    38
  suurballe_test
ladanyi@141
    39
  time_measure_test
ladanyi@679
    40
  unionfind_test
ladanyi@679
    41
)
ladanyi@141
    42
ladanyi@627
    43
IF(LEMON_HAVE_LP)
alpar@904
    44
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@904
    45
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@904
    46
  ELSE()
alpar@904
    47
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@904
    48
  ENDIF()
alpar@904
    49
ladanyi@620
    50
  SET(LP_TEST_LIBS lemon)
ladanyi@679
    51
ladanyi@627
    52
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    53
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
    54
  ENDIF()
ladanyi@627
    55
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
    56
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
    57
  ENDIF()
ladanyi@627
    58
  IF(LEMON_HAVE_CLP)
ladanyi@621
    59
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@679
    60
  ENDIF()
ladanyi@679
    61
ladanyi@620
    62
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    63
  ADD_TEST(lp_test lp_test)
ladanyi@473
    64
ladanyi@627
    65
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
    66
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@473
    67
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    68
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    69
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
    70
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
    71
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    72
    )
ladanyi@679
    73
  ENDIF()
ladanyi@679
    74
ladanyi@627
    75
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
    76
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@620
    77
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    78
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    79
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
    80
    )
ladanyi@679
    81
  ENDIF()
ladanyi@679
    82
ENDIF()
ladanyi@473
    83
ladanyi@627
    84
IF(LEMON_HAVE_MIP)
alpar@904
    85
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@904
    86
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@904
    87
  ELSE()
alpar@904
    88
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@904
    89
  ENDIF()
alpar@904
    90
ladanyi@620
    91
  SET(MIP_TEST_LIBS lemon)
ladanyi@679
    92
ladanyi@627
    93
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    94
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
    95
  ENDIF()
ladanyi@627
    96
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
    97
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
    98
  ENDIF()
ladanyi@627
    99
  IF(LEMON_HAVE_CBC)
ladanyi@621
   100
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@679
   101
  ENDIF()
ladanyi@679
   102
ladanyi@620
   103
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
   104
  ADD_TEST(mip_test mip_test)
ladanyi@473
   105
ladanyi@627
   106
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
   107
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@473
   108
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
   109
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   110
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
   111
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
   112
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
   113
    )
ladanyi@679
   114
  ENDIF()
ladanyi@679
   115
ladanyi@627
   116
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
   117
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@620
   118
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
   119
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   120
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
   121
    )
ladanyi@679
   122
  ENDIF()
ladanyi@679
   123
ENDIF()
ladanyi@473
   124
alpar@225
   125
FOREACH(TEST_NAME ${TESTS})
alpar@904
   126
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@904
   127
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@904
   128
  ELSE()
alpar@904
   129
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@904
   130
  ENDIF()
alpar@225
   131
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@225
   132
  ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@904
   133
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@679
   134
ENDFOREACH()