COIN-OR::LEMON - Graph Library

source: lemon/test/CMakeLists.txt @ 1033:16d466589b54

Last change on this file since 1033:16d466589b54 was 1033:16d466589b54, checked in by Alpar Juttner <alpar@…>, 9 years ago

Backport the CMAKE related changesets from the main branch

[e20fecd1945f] Add check target for CMake (#388)
[e74b5db4f2c6] Put the output of chg-len.py in the version string (#389)
[7d166b8b8018] Safer call of ./scripts/chg-len.py on Windows (#389)
[659ba4805a48] Make CMAKE config more consistent with configure.ac (#390)
[63e4468c680e] Add 'Maintainer' CMAKE build type (#388, #390)
[a725503acfe9] Allow CPACK configuration on all platforms
[10242c611190] Create and install lemon.pc (#393)
[48e29534cf03] The deafult target doesn't build lp_test and mip_test (#388)
[0fbbdd578c06] Full path for DoxygenLayout?.xml in Doxyfile.in (#395)
[481496e6d71f] SOURCE_BROWSER Doxygen switch is configurable from CMAKE (#395)
[09282720100b] update-external-tags CMAKE target (#395)

File size: 3.5 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  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
45    ADD_EXECUTABLE(lp_test lp_test.cc)
46  ELSE()
47    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
48  ENDIF()
49
50  SET(LP_TEST_LIBS lemon)
51
52  IF(LEMON_HAVE_GLPK)
53    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
54  ENDIF()
55  IF(LEMON_HAVE_CPLEX)
56    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
57  ENDIF()
58  IF(LEMON_HAVE_CLP)
59    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
60  ENDIF()
61
62  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
63  ADD_TEST(lp_test lp_test)
64
65  IF(WIN32 AND LEMON_HAVE_GLPK)
66    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
67    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
68    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
69      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
70      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
71      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
72    )
73  ENDIF()
74
75  IF(WIN32 AND LEMON_HAVE_CPLEX)
76    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
77    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
78    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
79      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
80    )
81  ENDIF()
82ENDIF()
83
84IF(LEMON_HAVE_MIP)
85  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
86    ADD_EXECUTABLE(mip_test mip_test.cc)
87  ELSE()
88    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
89  ENDIF()
90
91  SET(MIP_TEST_LIBS lemon)
92
93  IF(LEMON_HAVE_GLPK)
94    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
95  ENDIF()
96  IF(LEMON_HAVE_CPLEX)
97    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
98  ENDIF()
99  IF(LEMON_HAVE_CBC)
100    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
101  ENDIF()
102
103  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
104  ADD_TEST(mip_test mip_test)
105
106  IF(WIN32 AND LEMON_HAVE_GLPK)
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 ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
111      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
112      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
113    )
114  ENDIF()
115
116  IF(WIN32 AND LEMON_HAVE_CPLEX)
117    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
118    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
119    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
120      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
121    )
122  ENDIF()
123ENDIF()
124
125FOREACH(TEST_NAME ${TESTS})
126  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
127    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
128  ELSE()
129    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
130  ENDIF()
131  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
132  ADD_TEST(${TEST_NAME} ${TEST_NAME})
133  ADD_DEPENDENCIES(check ${TEST_NAME})
134ENDFOREACH()
Note: See TracBrowser for help on using the repository browser.