COIN-OR::LEMON - Graph Library

source: lemon-1.2/test/CMakeLists.txt @ 697:9496ed797f20

Last change on this file since 697:9496ed797f20 was 679:9c7639f3a741, checked in by Akos Ladanyi <ladanyi@…>, 11 years ago

Minor CMake improvements

  • Use the empty ELSE(), ENDIF(), ENDMACRO(), etc. syntax since this improves readability and requires less typing.
  • Use FIND_PACKAGE() instead of INCLUDE().
  • Use the value of CMAKE_COMMAND variable instead of cmake, since this works even if cmake is not in the PATH.
File size: 3.1 KB
RevLine 
[499]1INCLUDE_DIRECTORIES(
[549]2  ${PROJECT_SOURCE_DIR}
[499]3  ${PROJECT_BINARY_DIR}
4)
[141]5
[679]6LINK_DIRECTORIES(
7  ${PROJECT_BINARY_DIR}/lemon
8)
[141]9
[225]10SET(TESTS
[512]11  adaptors_test
[141]12  bfs_test
[424]13  circulation_test
[649]14  connectivity_test
[141]15  counter_test
16  dfs_test
17  digraph_test
[170]18  dijkstra_test
[141]19  dim_test
[512]20  edge_set_test
[141]21  error_test
[522]22  euler_test
[543]23  gomory_hu_test
[200]24  graph_copy_test
[141]25  graph_test
[171]26  graph_utils_test
[410]27  hao_orlin_test
[203]28  heap_test
[141]29  kruskal_test
30  maps_test
[594]31  matching_test
[490]32  min_cost_arborescence_test
[601]33  min_cost_flow_test
[424]34  path_test
35  preflow_test
[473]36  radix_sort_test
[225]37  random_test
[424]38  suurballe_test
[141]39  time_measure_test
[679]40  unionfind_test
41)
[141]42
[627]43IF(LEMON_HAVE_LP)
[473]44  ADD_EXECUTABLE(lp_test lp_test.cc)
[620]45  SET(LP_TEST_LIBS lemon)
[679]46
[627]47  IF(LEMON_HAVE_GLPK)
[620]48    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
[679]49  ENDIF()
[627]50  IF(LEMON_HAVE_CPLEX)
[620]51    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
[679]52  ENDIF()
[627]53  IF(LEMON_HAVE_CLP)
[621]54    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
[679]55  ENDIF()
56
[620]57  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
[473]58  ADD_TEST(lp_test lp_test)
59
[627]60  IF(WIN32 AND LEMON_HAVE_GLPK)
[473]61    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
62    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
63    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
[679]64      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
65      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
66      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
[473]67    )
[679]68  ENDIF()
69
[627]70  IF(WIN32 AND LEMON_HAVE_CPLEX)
[620]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
[679]74      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
[620]75    )
[679]76  ENDIF()
77ENDIF()
[473]78
[627]79IF(LEMON_HAVE_MIP)
[473]80  ADD_EXECUTABLE(mip_test mip_test.cc)
[620]81  SET(MIP_TEST_LIBS lemon)
[679]82
[627]83  IF(LEMON_HAVE_GLPK)
[620]84    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
[679]85  ENDIF()
[627]86  IF(LEMON_HAVE_CPLEX)
[620]87    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
[679]88  ENDIF()
[627]89  IF(LEMON_HAVE_CBC)
[621]90    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
[679]91  ENDIF()
92
[620]93  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
[473]94  ADD_TEST(mip_test mip_test)
95
[627]96  IF(WIN32 AND LEMON_HAVE_GLPK)
[473]97    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
98    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
99    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
[679]100      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
101      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
102      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
[473]103    )
[679]104  ENDIF()
105
[627]106  IF(WIN32 AND LEMON_HAVE_CPLEX)
[620]107    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
108    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
109    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
[679]110      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
[620]111    )
[679]112  ENDIF()
113ENDIF()
[473]114
[225]115FOREACH(TEST_NAME ${TESTS})
116  ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
117  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
118  ADD_TEST(${TEST_NAME} ${TEST_NAME})
[679]119ENDFOREACH()
Note: See TracBrowser for help on using the repository browser.