diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,9 +1,12 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} - ${GLPK_INCLUDE_DIR} ) +IF(HAVE_GLPK) + INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR}) +ENDIF(HAVE_GLPK) + LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon) SET(TESTS @@ -35,10 +38,12 @@ IF(HAVE_LP) ADD_EXECUTABLE(lp_test lp_test.cc) - TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES}) + IF(HAVE_GLPK) + TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES}) + ENDIF(HAVE_GLPK) ADD_TEST(lp_test lp_test) - IF(WIN32) + IF(WIN32 AND HAVE_GLPK) GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD @@ -46,15 +51,17 @@ COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} ) - ENDIF(WIN32) + ENDIF(WIN32 AND HAVE_GLPK) ENDIF(HAVE_LP) IF(HAVE_MIP) ADD_EXECUTABLE(mip_test mip_test.cc) - TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES}) + IF(HAVE_GLPK) + TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES}) + ENDIF(HAVE_GLPK) ADD_TEST(mip_test mip_test) - IF(WIN32) + IF(WIN32 AND HAVE_GLPK) GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD @@ -62,7 +69,7 @@ COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} ) - ENDIF(WIN32) + ENDIF(WIN32 AND HAVE_GLPK) ENDIF(HAVE_MIP) FOREACH(TEST_NAME ${TESTS})