Index: CMake/FLTKConfig.cmake.in
===================================================================
--- CMake/FLTKConfig.cmake.in	(revision 4393)
+++ CMake/FLTKConfig.cmake.in	(working copy)
@@ -12,7 +12,7 @@
 SET(FLUID_COMMAND "@FLTK_FLUID_COMMAND@")
 SET(FLTK_EXECUTABLE_DIRS "@FLTK_EXECUTABLE_DIRS@")
 SET(FLTK_LIBRARY_DIRS "@FLTK_LIBRARY_DIRS@")
-SET(FLTK_LIBRARIES "fltk_images;fltk;fltk_gl;fltk_forms")
+SET(FLTK_LIBRARIES "@FLTK_LIBRARIES@")
 SET(FLTK_INCLUDE_DIRS "@FLTK_INCLUDE_DIRS@")
 
 # The C and C++ flags added by FLTK to the cmake-configured flags.
Index: png/CMakeLists.txt
===================================================================
--- png/CMakeLists.txt	(revision 4393)
+++ png/CMakeLists.txt	(working copy)
@@ -19,7 +19,9 @@
   )
 
 ADD_LIBRARY(fltk_png ${PNG_SRCS})
+INSTALL_TARGETS(/lib fltk_png)
 
+
 IF(UNIX)
   TARGET_LINK_LIBRARIES(fltk_png ${FLTK_ZLIB_LIBRARIES} -lm)
 ELSE(UNIX)
Index: jpeg/CMakeLists.txt
===================================================================
--- jpeg/CMakeLists.txt	(revision 4393)
+++ jpeg/CMakeLists.txt	(working copy)
@@ -32,4 +32,5 @@
 )
 
 ADD_LIBRARY(fltk_jpeg ${systemdependent_SRCS} ${common_SRCS} ${compression_SRCS} ${decompression_SRCS})
+INSTALL_TARGETS(/lib fltk_jpeg)
 
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt	(revision 4393)
+++ src/CMakeLists.txt	(working copy)
@@ -161,6 +161,7 @@
   )
 
 ADD_LIBRARY(fltk ${CPPFILES} ${CFILES})
+INSTALL_TARGETS(/lib fltk)
 SET_TARGET_PROPERTIES(fltk
   PROPERTIES
   VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
@@ -174,6 +175,7 @@
 
 IF(OPENGL_FOUND)
   ADD_LIBRARY(fltk_gl ${GLCPPFILES})
+  INSTALL_TARGETS(/lib fltk_gl)
   TARGET_LINK_LIBRARIES(fltk_gl fltk ${OPENGL_LIBRARIES})
   SET_TARGET_PROPERTIES(fltk_gl
     PROPERTIES
@@ -182,6 +184,7 @@
 ENDIF(OPENGL_FOUND)
 
 ADD_LIBRARY(fltk_forms ${FLCPPFILES})
+INSTALL_TARGETS(/lib fltk_forms)
 TARGET_LINK_LIBRARIES(fltk_forms fltk)
 SET_TARGET_PROPERTIES(fltk_forms
   PROPERTIES
@@ -189,21 +192,11 @@
   SOVERSION ${FLTK_VERSION_PATCH})
 
 ADD_LIBRARY(fltk_images ${IMGCPPFILES})
-TARGET_LINK_LIBRARIES(fltk_images fltk)
+INSTALL_TARGETS(/lib fltk_images)
+TARGET_LINK_LIBRARIES(fltk_images fltk ${FLTK_PNG_LIBRARIES}
+     ${FLTK_JPEG_LIBRARIES} ${FLTK_ZLIB_LIBRARIES})
 SET_TARGET_PROPERTIES(fltk_images
   PROPERTIES
   VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
   SOVERSION ${FLTK_VERSION_PATCH})
 
-IF(HAVE_LIBPNG)
-  TARGET_LINK_LIBRARIES(fltk_images ${PNG_LIBRARIES})
-ENDIF(HAVE_LIBPNG)
-
-IF(HAVE_LIBJPEG)
-  TARGET_LINK_LIBRARIES(fltk_images ${JPEG_LIBRARIES})
-ENDIF(HAVE_LIBJPEG) 
-
-INSTALL_TARGETS(/lib fltk)
-INSTALL_TARGETS(/lib fltk_gl)
-INSTALL_TARGETS(/lib fltk_forms)
-INSTALL_TARGETS(/lib fltk_images)
Index: zlib/CMakeLists.txt
===================================================================
--- zlib/CMakeLists.txt	(revision 4393)
+++ zlib/CMakeLists.txt	(working copy)
@@ -11,4 +11,5 @@
 )
 
 ADD_LIBRARY(fltk_zlib ${ZLIB_SRCS})
+INSTALL_TARGETS(/lib fltk_zlib)
 
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 4393)
+++ CMakeLists.txt	(working copy)
@@ -11,6 +11,8 @@
 SET(FLTK_VERSION "${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}")
 SET(FLTK_VERSION_FULL "${FLTK_VERSION}.${FLTK_VERSION_PATCH}")
 
+SET(FLTK_LIBRARIES "fltk_images;fltk;fltk_gl;fltk_forms")
+
 # Executables and libraries should just go to bin
 SET(EXECUTABLE_OUTPUT_PATH "${FLTK_BINARY_DIR}/bin" CACHE INTERNAL 
   "Where to put the executables for FLTK"
@@ -72,6 +74,11 @@
   SET( FLTK_PLATFORM_DEPENDENT_LIBS ole32 uuid comctl32 wsock32 supc++ -lm -lgdi32)
 ENDIF(CYGWIN)
 
+IF(MINGW)
+  ADD_DEFINITIONS(-DWIN32)
+  SET( FLTK_PLATFORM_DEPENDENT_LIBS ole32 uuid wsock32 gdi32 comdlg32)
+ENDIF(MINGW)
+
 INCLUDE(CheckIncludeFiles)
 # Check if header file exists and add it to the list.
 MACRO(CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
@@ -182,6 +189,7 @@
 IF(FLTK_USE_SYSTEM_ZLIB)
   IF(ZLIB_FOUND)
     SET(CMAKE_TEST_SPECIAL_LIBRARIES ${ZLIB_LIBRARIES})
+    SET(FLTK_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
     PERFORM_CMAKE_TEST(CMake/PlatformTests.cxx HAVE_LIBZ)
   ENDIF(ZLIB_FOUND)
   # We build the fltk zlib
@@ -191,6 +199,7 @@
   SUBDIRS(zlib)
   SET(HAVE_LIBZ 1)
   SET(FLTK_ZLIB_LIBRARIES fltk_zlib)
+  SET(FLTK_LIBRARIES "${FLTK_LIBRARIES};fltk_zlib")
   INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/zlib")
 ENDIF(FLTK_USE_SYSTEM_ZLIB)
 
@@ -199,6 +208,7 @@
 IF(FLTK_USE_SYSTEM_JPEG)
   IF(JPEG_FOUND)
     SET(CMAKE_TEST_SPECIAL_LIBRARIES ${JPEG_LIBRARIES})
+    SET(FLTK_JPEG_LIBRARIES ${JPEG_LIBRARIES})
     PERFORM_CMAKE_TEST(CMake/PlatformTests.cxx HAVE_LIBJPEG)
   ENDIF(JPEG_FOUND)
   # We build the fltk png
@@ -207,7 +217,8 @@
   MARK_AS_ADVANCED(JPEG_LIBRARY)
   SUBDIRS(jpeg)
   SET(HAVE_LIBJPEG 1)
-  SET(JPEG_LIBRARIES fltk_jpeg)
+  SET(FLTK_JPEG_LIBRARIES fltk_jpeg)
+  SET(FLTK_LIBRARIES "${FLTK_LIBRARIES};fltk_jpeg")
   INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/jpeg")
 ENDIF(FLTK_USE_SYSTEM_JPEG)
 
@@ -216,6 +227,7 @@
 IF(FLTK_USE_SYSTEM_PNG)
   IF(PNG_FOUND)
     SET(CMAKE_TEST_SPECIAL_LIBRARIES ${PNG_LIBRARIES})
+    SET(FLTK_PNG_LIBRARIES ${PNG_LIBRARIES})
     PERFORM_CMAKE_TEST(CMake/PlatformTests.cxx HAVE_LIBPNG)
     PERFORM_CMAKE_TEST(CMake/PlatformTests.cxx HAVE_PNG_GET_VALID)
     PERFORM_CMAKE_TEST(CMake/PlatformTests.cxx HAVE_PNG_SET_TRNS_TO_ALPHA)
@@ -228,7 +240,8 @@
   SUBDIRS(png)
   SET(HAVE_LIBPNG 1)
   SET(HAVE_PNG_H 1)
-  SET(PNG_LIBRARIES fltk_png)
+  SET(FLTK_PNG_LIBRARIES fltk_png)
+  SET(FLTK_LIBRARIES "${FLTK_LIBRARIES};fltk_png")
   INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/png")
 ENDIF(FLTK_USE_SYSTEM_PNG)
 
Index: fluid/CMakeLists.txt
===================================================================
--- fluid/CMakeLists.txt	(revision 4393)
+++ fluid/CMakeLists.txt	(working copy)
@@ -22,9 +22,9 @@
 
 
 ADD_EXECUTABLE(fluid ${CPPFILES})
+INSTALL_TARGETS(/bin fluid)
 TARGET_LINK_LIBRARIES(fluid fltk fltk_images fltk_forms ${FLTK_PLATFORM_DEPENDENT_LIBS})
 IF(OPENGL_FOUND)
 	TARGET_LINK_LIBRARIES(fluid fltk_gl)
 ENDIF(OPENGL_FOUND)
 
-INSTALL_TARGETS(/bin fluid)
