test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Mon, 14 Dec 2009 06:07:52 +0100
changeset 888 f903263902f6
parent 861 30cb42e3e43a
parent 817 432c54cec63c
child 953 d8ea85825e02
permissions -rw-r--r--
Merge #180 and a bugfix in #51
     1 INCLUDE_DIRECTORIES(
     2   ${PROJECT_SOURCE_DIR}
     3   ${PROJECT_BINARY_DIR}
     4 )
     5 
     6 LINK_DIRECTORIES(
     7   ${PROJECT_BINARY_DIR}/lemon
     8 )
     9 
    10 SET(TESTS
    11   adaptors_test
    12   bellman_ford_test
    13   bfs_test
    14   circulation_test
    15   connectivity_test
    16   counter_test
    17   dfs_test
    18   digraph_test
    19   dijkstra_test
    20   dim_test
    21   edge_set_test
    22   error_test
    23   euler_test
    24   gomory_hu_test
    25   graph_copy_test
    26   graph_test
    27   graph_utils_test
    28   hao_orlin_test
    29   heap_test
    30   kruskal_test
    31   maps_test
    32   matching_test
    33   min_cost_arborescence_test
    34   min_cost_flow_test
    35   min_mean_cycle_test
    36   path_test
    37   planarity_test
    38   preflow_test
    39   radix_sort_test
    40   random_test
    41   suurballe_test
    42   time_measure_test
    43   unionfind_test
    44 )
    45 
    46 IF(LEMON_HAVE_LP)
    47   ADD_EXECUTABLE(lp_test lp_test.cc)
    48   SET(LP_TEST_LIBS lemon)
    49 
    50   IF(LEMON_HAVE_GLPK)
    51     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
    52   ENDIF()
    53   IF(LEMON_HAVE_CPLEX)
    54     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
    55   ENDIF()
    56   IF(LEMON_HAVE_CLP)
    57     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
    58   ENDIF()
    59 
    60   TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    61   ADD_TEST(lp_test lp_test)
    62 
    63   IF(WIN32 AND LEMON_HAVE_GLPK)
    64     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    65     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    66     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    67       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    68       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    69       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    70     )
    71   ENDIF()
    72 
    73   IF(WIN32 AND LEMON_HAVE_CPLEX)
    74     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    75     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    76     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    77       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
    78     )
    79   ENDIF()
    80 ENDIF()
    81 
    82 IF(LEMON_HAVE_MIP)
    83   ADD_EXECUTABLE(mip_test mip_test.cc)
    84   SET(MIP_TEST_LIBS lemon)
    85 
    86   IF(LEMON_HAVE_GLPK)
    87     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
    88   ENDIF()
    89   IF(LEMON_HAVE_CPLEX)
    90     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
    91   ENDIF()
    92   IF(LEMON_HAVE_CBC)
    93     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
    94   ENDIF()
    95 
    96   TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
    97   ADD_TEST(mip_test mip_test)
    98 
    99   IF(WIN32 AND LEMON_HAVE_GLPK)
   100     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   101     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   102     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   103       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
   104       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
   105       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
   106     )
   107   ENDIF()
   108 
   109   IF(WIN32 AND LEMON_HAVE_CPLEX)
   110     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   111     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   112     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   113       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
   114     )
   115   ENDIF()
   116 ENDIF()
   117 
   118 FOREACH(TEST_NAME ${TESTS})
   119   ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
   120   TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
   121   ADD_TEST(${TEST_NAME} ${TEST_NAME})
   122 ENDFOREACH()