COIN-OR::LEMON - Graph Library

source: lemon-1.2/test/CMakeLists.txt @ 679:9c7639f3a741

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