test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Fri, 04 Mar 2011 11:38:05 +0100
branch1.2
changeset 1039 7f37e5fc416e
parent 953 d8ea85825e02
parent 1033 16d466589b54
child 1051 cc9bb4f95ed3
permissions -rw-r--r--
Merge #404 to branch 1.2
     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   min_cost_arborescence_test
    35   min_cost_flow_test
    36   min_mean_cycle_test
    37   path_test
    38   planarity_test
    39   preflow_test
    40   radix_sort_test
    41   random_test
    42   suurballe_test
    43   time_measure_test
    44   unionfind_test
    45 )
    46 
    47 IF(LEMON_HAVE_LP)
    48   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
    49     ADD_EXECUTABLE(lp_test lp_test.cc)
    50   ELSE()
    51     ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
    52   ENDIF()
    53 
    54   SET(LP_TEST_LIBS lemon)
    55 
    56   IF(LEMON_HAVE_GLPK)
    57     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
    58   ENDIF()
    59   IF(LEMON_HAVE_CPLEX)
    60     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
    61   ENDIF()
    62   IF(LEMON_HAVE_CLP)
    63     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
    64   ENDIF()
    65 
    66   TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    67   ADD_TEST(lp_test lp_test)
    68 
    69   IF(WIN32 AND LEMON_HAVE_GLPK)
    70     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    71     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    72     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    73       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    74       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    75       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    76     )
    77   ENDIF()
    78 
    79   IF(WIN32 AND LEMON_HAVE_CPLEX)
    80     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    81     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    82     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    83       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
    84     )
    85   ENDIF()
    86 ENDIF()
    87 
    88 IF(LEMON_HAVE_MIP)
    89   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
    90     ADD_EXECUTABLE(mip_test mip_test.cc)
    91   ELSE()
    92     ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
    93   ENDIF()
    94 
    95   SET(MIP_TEST_LIBS lemon)
    96 
    97   IF(LEMON_HAVE_GLPK)
    98     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
    99   ENDIF()
   100   IF(LEMON_HAVE_CPLEX)
   101     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
   102   ENDIF()
   103   IF(LEMON_HAVE_CBC)
   104     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
   105   ENDIF()
   106 
   107   TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
   108   ADD_TEST(mip_test mip_test)
   109 
   110   IF(WIN32 AND LEMON_HAVE_GLPK)
   111     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   112     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   113     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   114       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
   115       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
   116       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
   117     )
   118   ENDIF()
   119 
   120   IF(WIN32 AND LEMON_HAVE_CPLEX)
   121     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   122     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   123     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   124       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
   125     )
   126   ENDIF()
   127 ENDIF()
   128 
   129 FOREACH(TEST_NAME ${TESTS})
   130   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
   131     ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
   132   ELSE()
   133     ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
   134   ENDIF()
   135   TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
   136   ADD_TEST(${TEST_NAME} ${TEST_NAME})
   137   ADD_DEPENDENCIES(check ${TEST_NAME})
   138 ENDFOREACH()