test/CMakeLists.txt
changeset 506 efec3c133e74
parent 473 17d918051964
child 507 e6ae4999cf22
equal deleted inserted replaced
17:6a8ad7b64645 18:536146c71a2d
     1 INCLUDE_DIRECTORIES(
     1 INCLUDE_DIRECTORIES(
     2   ${CMAKE_SOURCE_DIR}
     2   ${CMAKE_SOURCE_DIR}
     3   ${CMAKE_BINARY_DIR}
     3   ${CMAKE_BINARY_DIR}
     4   ${GLPK_INCLUDE_DIR}
       
     5 )
     4 )
       
     5 
       
     6 IF(HAVE_GLPK)
       
     7   INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR})
       
     8 ENDIF(HAVE_GLPK)
     6 
     9 
     7 LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
    10 LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
     8 
    11 
     9 SET(TESTS
    12 SET(TESTS
    10   adaptors_test
    13   adaptors_test
    33   time_measure_test
    36   time_measure_test
    34   unionfind_test)
    37   unionfind_test)
    35 
    38 
    36 IF(HAVE_LP)
    39 IF(HAVE_LP)
    37   ADD_EXECUTABLE(lp_test lp_test.cc)
    40   ADD_EXECUTABLE(lp_test lp_test.cc)
    38   TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
    41   IF(HAVE_GLPK)
       
    42     TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
       
    43   ENDIF(HAVE_GLPK)
    39   ADD_TEST(lp_test lp_test)
    44   ADD_TEST(lp_test lp_test)
    40 
    45 
    41   IF(WIN32)
    46   IF(WIN32 AND HAVE_GLPK)
    42     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    47     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    43     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    48     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    44     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    49     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    45       COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    50       COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    46       COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    51       COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    47       COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    52       COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    48     )
    53     )
    49   ENDIF(WIN32)
    54   ENDIF(WIN32 AND HAVE_GLPK)
    50 ENDIF(HAVE_LP)
    55 ENDIF(HAVE_LP)
    51 
    56 
    52 IF(HAVE_MIP)
    57 IF(HAVE_MIP)
    53   ADD_EXECUTABLE(mip_test mip_test.cc)
    58   ADD_EXECUTABLE(mip_test mip_test.cc)
    54   TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES})
    59   IF(HAVE_GLPK)
       
    60     TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES})
       
    61   ENDIF(HAVE_GLPK)
    55   ADD_TEST(mip_test mip_test)
    62   ADD_TEST(mip_test mip_test)
    56 
    63 
    57   IF(WIN32)
    64   IF(WIN32 AND HAVE_GLPK)
    58     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
    65     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
    59     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    66     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    60     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
    67     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
    61       COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    68       COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    62       COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    69       COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    63       COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    70       COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    64     )
    71     )
    65   ENDIF(WIN32)
    72   ENDIF(WIN32 AND HAVE_GLPK)
    66 ENDIF(HAVE_MIP)
    73 ENDIF(HAVE_MIP)
    67 
    74 
    68 FOREACH(TEST_NAME ${TESTS})
    75 FOREACH(TEST_NAME ${TESTS})
    69   ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
    76   ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
    70   TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
    77   TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)