test/CMakeLists.txt
author Akos Ladanyi <ladanyi@tmit.bme.hu>
Fri, 29 May 2009 11:40:53 +0100
changeset 678 d1e1cd94bf49
parent 627 20dac2104519
child 679 9c7639f3a741
permissions -rw-r--r--
Put the version string into config.h

Also make it possible to set the version using the LEMON_VERSION environment
variable, and use the hg revision as version string in case this variable is
unset.
     1 INCLUDE_DIRECTORIES(
     2   ${PROJECT_SOURCE_DIR}
     3   ${PROJECT_BINARY_DIR}
     4 )
     5 
     6 LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon)
     7 
     8 SET(TESTS
     9   adaptors_test
    10   bfs_test
    11   circulation_test
    12   connectivity_test
    13   counter_test
    14   dfs_test
    15   digraph_test
    16   dijkstra_test
    17   dim_test
    18   edge_set_test
    19   error_test
    20   euler_test
    21   gomory_hu_test
    22   graph_copy_test
    23   graph_test
    24   graph_utils_test
    25   hao_orlin_test
    26   heap_test
    27   kruskal_test
    28   maps_test
    29   matching_test
    30   min_cost_arborescence_test
    31   min_cost_flow_test
    32   path_test
    33   preflow_test
    34   radix_sort_test
    35   random_test
    36   suurballe_test
    37   time_measure_test
    38   unionfind_test)
    39 
    40 IF(LEMON_HAVE_LP)
    41   ADD_EXECUTABLE(lp_test lp_test.cc)
    42   SET(LP_TEST_LIBS lemon)
    43   IF(LEMON_HAVE_GLPK)
    44     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
    45   ENDIF(LEMON_HAVE_GLPK)
    46   IF(LEMON_HAVE_CPLEX)
    47     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
    48   ENDIF(LEMON_HAVE_CPLEX)
    49   IF(LEMON_HAVE_CLP)
    50     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
    51   ENDIF(LEMON_HAVE_CLP)
    52   TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    53   ADD_TEST(lp_test lp_test)
    54 
    55   IF(WIN32 AND LEMON_HAVE_GLPK)
    56     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    57     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    58     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    59       COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    60       COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    61       COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    62     )
    63   ENDIF(WIN32 AND LEMON_HAVE_GLPK)
    64   IF(WIN32 AND LEMON_HAVE_CPLEX)
    65     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    66     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    67     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    68       COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
    69     )
    70   ENDIF(WIN32 AND LEMON_HAVE_CPLEX)
    71 ENDIF(LEMON_HAVE_LP)
    72 
    73 IF(LEMON_HAVE_MIP)
    74   ADD_EXECUTABLE(mip_test mip_test.cc)
    75   SET(MIP_TEST_LIBS lemon)
    76   IF(LEMON_HAVE_GLPK)
    77     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
    78   ENDIF(LEMON_HAVE_GLPK)
    79   IF(LEMON_HAVE_CPLEX)
    80     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
    81   ENDIF(LEMON_HAVE_CPLEX)
    82   IF(LEMON_HAVE_CBC)
    83     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
    84   ENDIF(LEMON_HAVE_CBC)
    85   TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
    86   ADD_TEST(mip_test mip_test)
    87 
    88   IF(WIN32 AND LEMON_HAVE_GLPK)
    89     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
    90     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    91     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
    92       COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    93       COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    94       COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    95     )
    96   ENDIF(WIN32 AND LEMON_HAVE_GLPK)
    97   IF(WIN32 AND LEMON_HAVE_CPLEX)
    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 -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
   102     )
   103   ENDIF(WIN32 AND LEMON_HAVE_CPLEX)
   104 ENDIF(LEMON_HAVE_MIP)
   105 
   106 FOREACH(TEST_NAME ${TESTS})
   107   ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
   108   TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
   109   ADD_TEST(${TEST_NAME} ${TEST_NAME})
   110 ENDFOREACH(TEST_NAME)