Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 274)
+++ CMakeLists.txt	(revision 473)
@@ -10,4 +10,13 @@
 INCLUDE(FindDoxygen)
 INCLUDE(FindGhostscript)
+FIND_PACKAGE(GLPK 4.33)
+
+ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+
+IF(GLPK_FOUND)
+  SET(HAVE_LP TRUE)
+  SET(HAVE_MIP TRUE)
+  SET(HAVE_GLPK TRUE)
+ENDIF(GLPK_FOUND)
 
 ENABLE_TESTING()
Index: cmake/FindGLPK.cmake
===================================================================
--- cmake/FindGLPK.cmake	(revision 473)
+++ cmake/FindGLPK.cmake	(revision 473)
@@ -0,0 +1,20 @@
+SET(GLPK_REGKEY "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Glpk;InstallPath]")
+GET_FILENAME_COMPONENT(GLPK_ROOT_PATH ${GLPK_REGKEY} ABSOLUTE)
+
+FIND_PATH(GLPK_INCLUDE_DIR
+  glpk.h
+  PATHS ${GLPK_REGKEY}/include)
+
+FIND_LIBRARY(GLPK_LIBRARY
+  NAMES glpk
+  PATHS ${GLPK_REGKEY}/lib)
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLPK DEFAULT_MSG GLPK_LIBRARY GLPK_INCLUDE_DIR)
+
+IF(GLPK_FOUND)
+  SET(GLPK_LIBRARIES ${GLPK_LIBRARY})
+  SET(GLPK_BIN_DIR ${GLPK_ROOT_PATH}/bin)
+ENDIF(GLPK_FOUND)
+
+MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)
Index: demo/CMakeLists.txt
===================================================================
--- demo/CMakeLists.txt	(revision 225)
+++ demo/CMakeLists.txt	(revision 473)
@@ -1,3 +1,7 @@
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
+INCLUDE_DIRECTORIES(
+  ${CMAKE_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}
+  ${GLPK_INCLUDE_DIR}
+)
 
 LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
Index: lemon/CMakeLists.txt
===================================================================
--- lemon/CMakeLists.txt	(revision 459)
+++ lemon/CMakeLists.txt	(revision 473)
@@ -1,9 +1,26 @@
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
+INCLUDE_DIRECTORIES(
+  ${CMAKE_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}
+  ${GLPK_INCLUDE_DIR}
+)
 
-ADD_LIBRARY(lemon
+CONFIGURE_FILE(
+  ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
+  ${CMAKE_CURRENT_BINARY_DIR}/config.h
+)
+
+SET(LEMON_SOURCES
   arg_parser.cc
   base.cc
   color.cc
+  lp_base.cc
+  lp_skeleton.cc
   random.cc)
+
+IF(HAVE_GLPK)
+  SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc)
+ENDIF(HAVE_GLPK)
+
+ADD_LIBRARY(lemon ${LEMON_SOURCES})
 
 INSTALL(
@@ -17,2 +34,8 @@
   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)
Index: lemon/config.h.cmake
===================================================================
--- lemon/config.h.cmake	(revision 473)
+++ lemon/config.h.cmake	(revision 473)
@@ -0,0 +1,3 @@
+#cmakedefine HAVE_LP 1
+#cmakedefine HAVE_MIP 1
+#cmakedefine HAVE_GLPK 1
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt	(revision 469)
+++ test/CMakeLists.txt	(revision 473)
@@ -1,3 +1,7 @@
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
+INCLUDE_DIRECTORIES(
+  ${CMAKE_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}
+  ${GLPK_INCLUDE_DIR}
+)
 
 LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
@@ -12,6 +16,6 @@
   dijkstra_test
   dim_test
+  edge_set_test
   error_test
-  edge_set_test
   graph_copy_test
   graph_test
@@ -20,15 +24,45 @@
   heap_test
   kruskal_test
-  lp_test
-  mip_test
   maps_test
   max_matching_test
-  radix_sort_test
   path_test
   preflow_test
+  radix_sort_test
   random_test
   suurballe_test
   time_measure_test
   unionfind_test)
+
+IF(HAVE_LP)
+  ADD_EXECUTABLE(lp_test lp_test.cc)
+  TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
+  ADD_TEST(lp_test lp_test)
+
+  IF(WIN32)
+    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
+    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
+    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
+      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
+      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(HAVE_LP)
+
+IF(HAVE_MIP)
+  ADD_EXECUTABLE(mip_test mip_test.cc)
+  TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES})
+  ADD_TEST(mip_test mip_test)
+
+  IF(WIN32)
+    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
+    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
+    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
+      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
+      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(HAVE_MIP)
 
 FOREACH(TEST_NAME ${TESTS})
