Fix CMAKE build without GLPK
authorAkos Ladanyi <ladanyi@tmit.bme.hu>
Wed, 21 Jan 2009 18:08:31 +0000
changeset 474f59df77f5c8d
parent 473 17d918051964
child 476 efec3c133e74
Fix CMAKE build without GLPK
demo/CMakeLists.txt
lemon/CMakeLists.txt
test/CMakeLists.txt
     1.1 --- a/demo/CMakeLists.txt	Tue Jan 20 12:23:14 2009 +0000
     1.2 +++ b/demo/CMakeLists.txt	Wed Jan 21 18:08:31 2009 +0000
     1.3 @@ -1,7 +1,6 @@
     1.4  INCLUDE_DIRECTORIES(
     1.5    ${CMAKE_SOURCE_DIR}
     1.6    ${CMAKE_BINARY_DIR}
     1.7 -  ${GLPK_INCLUDE_DIR}
     1.8  )
     1.9  
    1.10  LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
     2.1 --- a/lemon/CMakeLists.txt	Tue Jan 20 12:23:14 2009 +0000
     2.2 +++ b/lemon/CMakeLists.txt	Wed Jan 21 18:08:31 2009 +0000
     2.3 @@ -1,7 +1,6 @@
     2.4  INCLUDE_DIRECTORIES(
     2.5    ${CMAKE_SOURCE_DIR}
     2.6    ${CMAKE_BINARY_DIR}
     2.7 -  ${GLPK_INCLUDE_DIR}
     2.8  )
     2.9  
    2.10  CONFIGURE_FILE(
    2.11 @@ -19,6 +18,12 @@
    2.12  
    2.13  IF(HAVE_GLPK)
    2.14    SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc)
    2.15 +  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR})
    2.16 +  IF(WIN32)
    2.17 +    INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin)
    2.18 +    INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin)
    2.19 +    INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin)
    2.20 +  ENDIF(WIN32)
    2.21  ENDIF(HAVE_GLPK)
    2.22  
    2.23  ADD_LIBRARY(lemon ${LEMON_SOURCES})
    2.24 @@ -33,9 +38,3 @@
    2.25    DESTINATION include/lemon
    2.26    COMPONENT headers
    2.27    FILES_MATCHING PATTERN "*.h")
    2.28 -
    2.29 -IF(WIN32)
    2.30 -  INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin)
    2.31 -  INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin)
    2.32 -  INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin)
    2.33 -ENDIF(WIN32)
     3.1 --- a/test/CMakeLists.txt	Tue Jan 20 12:23:14 2009 +0000
     3.2 +++ b/test/CMakeLists.txt	Wed Jan 21 18:08:31 2009 +0000
     3.3 @@ -1,9 +1,12 @@
     3.4  INCLUDE_DIRECTORIES(
     3.5    ${CMAKE_SOURCE_DIR}
     3.6    ${CMAKE_BINARY_DIR}
     3.7 -  ${GLPK_INCLUDE_DIR}
     3.8  )
     3.9  
    3.10 +IF(HAVE_GLPK)
    3.11 +  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR})
    3.12 +ENDIF(HAVE_GLPK)
    3.13 +
    3.14  LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
    3.15  
    3.16  SET(TESTS
    3.17 @@ -35,10 +38,12 @@
    3.18  
    3.19  IF(HAVE_LP)
    3.20    ADD_EXECUTABLE(lp_test lp_test.cc)
    3.21 -  TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
    3.22 +  IF(HAVE_GLPK)
    3.23 +    TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
    3.24 +  ENDIF(HAVE_GLPK)
    3.25    ADD_TEST(lp_test lp_test)
    3.26  
    3.27 -  IF(WIN32)
    3.28 +  IF(WIN32 AND HAVE_GLPK)
    3.29      GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    3.30      GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    3.31      ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    3.32 @@ -46,15 +51,17 @@
    3.33        COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    3.34        COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    3.35      )
    3.36 -  ENDIF(WIN32)
    3.37 +  ENDIF(WIN32 AND HAVE_GLPK)
    3.38  ENDIF(HAVE_LP)
    3.39  
    3.40  IF(HAVE_MIP)
    3.41    ADD_EXECUTABLE(mip_test mip_test.cc)
    3.42 -  TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES})
    3.43 +  IF(HAVE_GLPK)
    3.44 +    TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES})
    3.45 +  ENDIF(HAVE_GLPK)
    3.46    ADD_TEST(mip_test mip_test)
    3.47  
    3.48 -  IF(WIN32)
    3.49 +  IF(WIN32 AND HAVE_GLPK)
    3.50      GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
    3.51      GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    3.52      ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
    3.53 @@ -62,7 +69,7 @@
    3.54        COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    3.55        COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    3.56      )
    3.57 -  ENDIF(WIN32)
    3.58 +  ENDIF(WIN32 AND HAVE_GLPK)
    3.59  ENDIF(HAVE_MIP)
    3.60  
    3.61  FOREACH(TEST_NAME ${TESTS})