COIN-OR::LEMON - Graph Library

source: lemon/test/CMakeLists.txt @ 784:9d6c3e8b2421

Last change on this file since 784:9d6c3e8b2421 was 726:9c7639f3a741, checked in by Akos Ladanyi <ladanyi@…>, 10 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 
[539]1INCLUDE_DIRECTORIES(
[596]2  ${PROJECT_SOURCE_DIR}
[539]3  ${PROJECT_BINARY_DIR}
4)
[141]5
[726]6LINK_DIRECTORIES(
7  ${PROJECT_BINARY_DIR}/lemon
8)
[141]9
[225]10SET(TESTS
[559]11  adaptors_test
[141]12  bfs_test
[443]13  circulation_test
[696]14  connectivity_test
[141]15  counter_test
16  dfs_test
17  digraph_test
[170]18  dijkstra_test
[141]19  dim_test
[559]20  edge_set_test
[141]21  error_test
[569]22  euler_test
[590]23  gomory_hu_test
[200]24  graph_copy_test
[141]25  graph_test
[171]26  graph_utils_test
[426]27  hao_orlin_test
[203]28  heap_test
[141]29  kruskal_test
30  maps_test
[641]31  matching_test
[522]32  min_cost_arborescence_test
[648]33  min_cost_flow_test
[443]34  path_test
35  preflow_test
[496]36  radix_sort_test
[225]37  random_test
[443]38  suurballe_test
[141]39  time_measure_test
[726]40  unionfind_test
41)
[141]42
[674]43IF(LEMON_HAVE_LP)
[496]44  ADD_EXECUTABLE(lp_test lp_test.cc)
[667]45  SET(LP_TEST_LIBS lemon)
[726]46
[674]47  IF(LEMON_HAVE_GLPK)
[667]48    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
[726]49  ENDIF()
[674]50  IF(LEMON_HAVE_CPLEX)
[667]51    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
[726]52  ENDIF()
[674]53  IF(LEMON_HAVE_CLP)
[668]54    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
[726]55  ENDIF()
56
[667]57  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
[496]58  ADD_TEST(lp_test lp_test)
59
[674]60  IF(WIN32 AND LEMON_HAVE_GLPK)
[496]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
[726]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}
[496]67    )
[726]68  ENDIF()
69
[674]70  IF(WIN32 AND LEMON_HAVE_CPLEX)
[667]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
[726]74      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
[667]75    )
[726]76  ENDIF()
77ENDIF()
[496]78
[674]79IF(LEMON_HAVE_MIP)
[496]80  ADD_EXECUTABLE(mip_test mip_test.cc)
[667]81  SET(MIP_TEST_LIBS lemon)
[726]82
[674]83  IF(LEMON_HAVE_GLPK)
[667]84    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
[726]85  ENDIF()
[674]86  IF(LEMON_HAVE_CPLEX)
[667]87    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
[726]88  ENDIF()
[674]89  IF(LEMON_HAVE_CBC)
[668]90    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
[726]91  ENDIF()
92
[667]93  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
[496]94  ADD_TEST(mip_test mip_test)
95
[674]96  IF(WIN32 AND LEMON_HAVE_GLPK)
[496]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
[726]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}
[496]103    )
[726]104  ENDIF()
105
[674]106  IF(WIN32 AND LEMON_HAVE_CPLEX)
[667]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
[726]110      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
[667]111    )
[726]112  ENDIF()
113ENDIF()
[496]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})
[726]119ENDFOREACH()
Note: See TracBrowser for help on using the repository browser.