test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Tue, 16 Nov 2010 07:46:01 +0100
changeset 1021 4980b05606bd
parent 1020 70bee017b584
parent 1018 35ba7236bd67
child 1040 8e39ccaabf48
child 1203 07682e24c4e8
permissions -rw-r--r--
Merge
     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   fractional_matching_test
    25   gomory_hu_test
    26   graph_copy_test
    27   graph_test
    28   graph_utils_test
    29   hao_orlin_test
    30   heap_test
    31   kruskal_test
    32   maps_test
    33   matching_test
    34   max_cardinality_search_test
    35   max_clique_test
    36   min_cost_arborescence_test
    37   min_cost_flow_test
    38   min_mean_cycle_test
    39   nagamochi_ibaraki_test
    40   path_test
    41   planarity_test
    42   preflow_test
    43   radix_sort_test
    44   random_test
    45   suurballe_test
    46   time_measure_test
    47   unionfind_test
    48 )
    49 
    50 IF(LEMON_HAVE_LP)
    51   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
    52     ADD_EXECUTABLE(lp_test lp_test.cc)
    53   ELSE()
    54     ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
    55   ENDIF()
    56 
    57   SET(LP_TEST_LIBS lemon)
    58 
    59   IF(LEMON_HAVE_GLPK)
    60     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
    61   ENDIF()
    62   IF(LEMON_HAVE_CPLEX)
    63     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
    64   ENDIF()
    65   IF(LEMON_HAVE_CLP)
    66     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
    67   ENDIF()
    68 
    69   TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    70   ADD_TEST(lp_test lp_test)
    71 
    72   IF(WIN32 AND LEMON_HAVE_GLPK)
    73     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    74     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    75     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    76       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    77       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    78       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    79     )
    80   ENDIF()
    81 
    82   IF(WIN32 AND LEMON_HAVE_CPLEX)
    83     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    84     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    85     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    86       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
    87     )
    88   ENDIF()
    89 ENDIF()
    90 
    91 IF(LEMON_HAVE_MIP)
    92   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
    93     ADD_EXECUTABLE(mip_test mip_test.cc)
    94   ELSE()
    95     ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
    96   ENDIF()
    97 
    98   SET(MIP_TEST_LIBS lemon)
    99 
   100   IF(LEMON_HAVE_GLPK)
   101     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
   102   ENDIF()
   103   IF(LEMON_HAVE_CPLEX)
   104     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
   105   ENDIF()
   106   IF(LEMON_HAVE_CBC)
   107     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
   108   ENDIF()
   109 
   110   TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
   111   ADD_TEST(mip_test mip_test)
   112 
   113   IF(WIN32 AND LEMON_HAVE_GLPK)
   114     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   115     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   116     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   117       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
   118       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
   119       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
   120     )
   121   ENDIF()
   122 
   123   IF(WIN32 AND LEMON_HAVE_CPLEX)
   124     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   125     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   126     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   127       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
   128     )
   129   ENDIF()
   130 ENDIF()
   131 
   132 FOREACH(TEST_NAME ${TESTS})
   133   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
   134     ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
   135   ELSE()
   136     ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
   137   ENDIF()
   138   TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
   139   ADD_TEST(${TEST_NAME} ${TEST_NAME})
   140   ADD_DEPENDENCIES(check ${TEST_NAME})
   141 ENDFOREACH()