test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Mon, 12 Oct 2009 17:02:03 +0100
changeset 753 48fe2a46bf91
parent 679 9c7639f3a741
child 770 432c54cec63c
child 797 30cb42e3e43a
child 869 636dadefe1e6
permissions -rw-r--r--
Merge bugfix #322
     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   path_test
    36   preflow_test
    37   radix_sort_test
    38   random_test
    39   suurballe_test
    40   time_measure_test
    41   unionfind_test
    42 )
    43 
    44 IF(LEMON_HAVE_LP)
    45   ADD_EXECUTABLE(lp_test lp_test.cc)
    46   SET(LP_TEST_LIBS lemon)
    47 
    48   IF(LEMON_HAVE_GLPK)
    49     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
    50   ENDIF()
    51   IF(LEMON_HAVE_CPLEX)
    52     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
    53   ENDIF()
    54   IF(LEMON_HAVE_CLP)
    55     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
    56   ENDIF()
    57 
    58   TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    59   ADD_TEST(lp_test lp_test)
    60 
    61   IF(WIN32 AND LEMON_HAVE_GLPK)
    62     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    63     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    64     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    65       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    66       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    67       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    68     )
    69   ENDIF()
    70 
    71   IF(WIN32 AND LEMON_HAVE_CPLEX)
    72     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    73     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    74     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    75       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
    76     )
    77   ENDIF()
    78 ENDIF()
    79 
    80 IF(LEMON_HAVE_MIP)
    81   ADD_EXECUTABLE(mip_test mip_test.cc)
    82   SET(MIP_TEST_LIBS lemon)
    83 
    84   IF(LEMON_HAVE_GLPK)
    85     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
    86   ENDIF()
    87   IF(LEMON_HAVE_CPLEX)
    88     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
    89   ENDIF()
    90   IF(LEMON_HAVE_CBC)
    91     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
    92   ENDIF()
    93 
    94   TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
    95   ADD_TEST(mip_test mip_test)
    96 
    97   IF(WIN32 AND LEMON_HAVE_GLPK)
    98     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
    99     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   100     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   101       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
   102       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
   103       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
   104     )
   105   ENDIF()
   106 
   107   IF(WIN32 AND LEMON_HAVE_CPLEX)
   108     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   109     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   110     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   111       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
   112     )
   113   ENDIF()
   114 ENDIF()
   115 
   116 FOREACH(TEST_NAME ${TESTS})
   117   ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
   118   TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
   119   ADD_TEST(${TEST_NAME} ${TEST_NAME})
   120 ENDFOREACH()