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