test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Thu, 07 Apr 2011 16:57:35 +0200
changeset 749 64260c0f58eb
parent 681 9c7639f3a741
child 747 66156a3498ea
permissions -rw-r--r--
Better Win CodeBlock/MinGW support (#418)
- Remove -ansi compilation flag
- Don't include sys/times.h when WIN32 is defined
     1 INCLUDE_DIRECTORIES(
     2   ${PROJECT_SOURCE_DIR}
     3   ${PROJECT_BINARY_DIR}
     4 )
     5 
     6 LINK_DIRECTORIES(
     7   ${PROJECT_BINARY_DIR}/lemon
     8 )
     9 
    10 SET(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 
    43 IF(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()
    82 ENDIF()
    83 
    84 IF(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()
   123 ENDIF()
   124 
   125 FOREACH(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})
   134 ENDFOREACH()