# HG changeset patch # User Akos Ladanyi # Date 2009-01-21 19:08:31 # Node ID f59df77f5c8d821b7be63dd64e78c44f036ec62a # Parent 17d918051964362329f8a92dea8564eb732b87ae Fix CMAKE build without GLPK diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -1,7 +1,6 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} - ${GLPK_INCLUDE_DIR} ) LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon) diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt --- a/lemon/CMakeLists.txt +++ b/lemon/CMakeLists.txt @@ -1,7 +1,6 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} - ${GLPK_INCLUDE_DIR} ) CONFIGURE_FILE( @@ -19,6 +18,12 @@ IF(HAVE_GLPK) SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc) + INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR}) + IF(WIN32) + INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin) + INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin) + INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin) + ENDIF(WIN32) ENDIF(HAVE_GLPK) ADD_LIBRARY(lemon ${LEMON_SOURCES}) @@ -33,9 +38,3 @@ DESTINATION include/lemon COMPONENT headers FILES_MATCHING PATTERN "*.h") - -IF(WIN32) - INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin) - INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin) - INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin) -ENDIF(WIN32) 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})