Index: CMake/export.cmake
===================================================================
--- CMake/export.cmake	(revision 10462)
+++ CMake/export.cmake	(working copy)
@@ -68,7 +68,25 @@
    @ONLY
 )
 
-# generate fltk-config
+### generate fltk-config
+# Set install locations, this could be shortened with a foreach loop...
+if(IS_ABSOLUTE ${FLTK_INSTALL_BINDIR})
+   set(FLTK_FULL_BINDIR ${FLTK_BINDIR})
+else()
+   set(FLTK_FULL_BINDIR ${CMAKE_INSTALL_PREFIX}/${FLTK_BINDIR})
+endif()
+if(IS_ABSOLUTE ${FLTK_INCLUDEDIR})
+   set(FLTK_FULL_INCLUDEDIR ${FLTK_INCLUDEDIR})
+else()
+   set(FLTK_FULL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${FLTK_INCLUDEDIR})
+endif()
+if(IS_ABSOLUTE ${FLTK_LIBDIR})
+   set(FLTK_FULL_LIBDIR ${FLTK_LIBDIR})
+else()
+   set(FLTK_FULL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${FLTK_LIBDIR})
+endif()
+
+# set compiler
 get_filename_component(CC ${CMAKE_C_COMPILER} NAME)
 get_filename_component(CXX ${CMAKE_CXX_COMPILER} NAME)
 
@@ -91,6 +109,12 @@
 endif(UNIX)
 
 if(OPTION_CREATE_LINKS)
+   # Set PREFIX_INCLUDE to the proper value.
+   if(IS_ABSOLUTE ${FLTK_INCLUDEDIR})
+      set(PREFIX_INCLUDE ${FLTK_INCLUDEDIR})
+   else()
+      set(PREFIX_INCLUDE "${CMAKE_INSTALL_PREFIX}/${FLTK_INCLUDEDIR}")
+   endif()
    configure_file(
       "${FLTK_SOURCE_DIR}/CMake/install-symlinks.cmake.in"
       "${FLTK_BINARY_DIR}/install-symlinks.cmake"
Index: CMake/install-symlinks.cmake.in
===================================================================
--- CMake/install-symlinks.cmake.in	(revision 10462)
+++ CMake/install-symlinks.cmake.in	(working copy)
@@ -1,17 +1,17 @@
 
 # On unix create backward compatibility symlinks
-if(NOT EXISTS @PREFIX_INCLUDE@/Fl)
+if(NOT EXISTS $ENV{DESTDIR}@PREFIX_INCLUDE@/Fl)
    EXECUTE_PROCESS(COMMAND ln -s FL Fl
-      WORKING_DIRECTORY @PREFIX_INCLUDE@
+      WORKING_DIRECTORY $ENV{DESTDIR}@PREFIX_INCLUDE@
       )
-endif(NOT EXISTS @PREFIX_INCLUDE@/Fl)
+endif()
 
-file(GLOB FLTK_HEADER_FILES @PREFIX_INCLUDE@/FL/*.H)
+file(GLOB FLTK_HEADER_FILES $ENV{DESTDIR}@PREFIX_INCLUDE@/FL/*.H)
 foreach(file ${FLTK_HEADER_FILES})
    GET_FILENAME_COMPONENT(nameWE ${file} NAME_WE)
-   if(NOT EXISTS @PREFIX_INCLUDE@/FL/${nameWE}.h)
+   if(NOT EXISTS $ENV{DESTDIR}@PREFIX_INCLUDE@/FL/${nameWE}.h)
       EXECUTE_PROCESS(COMMAND ln -s ${nameWE}.H ${nameWE}.h
-         WORKING_DIRECTORY @PREFIX_INCLUDE@/FL
+         WORKING_DIRECTORY $ENV{DESTDIR}@PREFIX_INCLUDE@/FL
       )
    endif()
 endforeach(file)
Index: CMake/install.cmake
===================================================================
--- CMake/install.cmake	(revision 10462)
+++ CMake/install.cmake	(working copy)
@@ -32,7 +32,7 @@
 )
 
 install(DIRECTORY ${FLTK_SOURCE_DIR}/FL
-   DESTINATION include USE_SOURCE_PERMISSIONS
+   DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS
    PATTERN ".svn" EXCLUDE
 )
 
@@ -70,11 +70,11 @@
    DESTINATION ${FLTK_CONFIG_PATH}
 )
 
-if(UNIX)
+if(UNIX OR MSYS OR (MINGW AND CMAKE_CROSSCOMPILING))
    macro(INSTALL_MAN FILE LEVEL)
    install(FILES
       ${FLTK_SOURCE_DIR}/documentation/src/${FILE}.man
-      DESTINATION share/man/man${LEVEL}
+      DESTINATION ${FLTK_MANDIR}/man${LEVEL}
       RENAME ${FILE}.${LEVEL}
    )
    endmacro(INSTALL_MAN FILE LEVEL)
@@ -86,4 +86,4 @@
    INSTALL_MAN(checkers 6)
    INSTALL_MAN(sudoku 6)
 
-endif(UNIX)
+endif()
Index: CMake/macros.cmake
===================================================================
--- CMake/macros.cmake	(revision 10462)
+++ CMake/macros.cmake	(working copy)
@@ -65,9 +65,9 @@
 
     install(TARGETS ${LIBRARY_NAME}
         EXPORT FLTK-Targets
-        RUNTIME DESTINATION bin
-        LIBRARY DESTINATION lib
-        ARCHIVE DESTINATION lib
+        RUNTIME DESTINATION ${FLTK_BINDIR}
+        LIBRARY DESTINATION ${FLTK_LIBDIR}
+        ARCHIVE DESTINATION ${FLTK_LIBDIR}
         )
 
     list(APPEND FLTK_LIBRARIES "${LIBRARY_NAME}")
Index: CMake/setup.cmake
===================================================================
--- CMake/setup.cmake	(revision 10462)
+++ CMake/setup.cmake	(working copy)
@@ -37,6 +37,31 @@
 set(FLTK_INCLUDE_DIRS ${FLTK_BINARY_DIR} ${FLTK_SOURCE_DIR})
 include_directories(${FLTK_INCLUDE_DIRS})
 
+# Setup install locations
+if(CMAKE_VERSION VERSION_GREATER 2.8.4)
+    # Use GNUInstallDirs if available.
+    include(GNUInstallDirs)
+else()
+    # Else set reasonable defaults.
+    set(CMAKE_INSTALL_BINDIR bin)
+    set(CMAKE_INSTALL_LIBDIR lib)
+    set(CMAKE_INSTALL_INCLUDEDIR include)
+    set(CMAKE_INSTALL_DATADIR share)
+    set(CMAKE_INSTALL_MANDIR share/man)
+endif()
+
+set(FLTK_BINDIR ${CMAKE_INSTALL_BINDIR} CACHE PATH
+    "Binary install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
+set(FLTK_LIBDIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH
+    "Library install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
+set(FLTK_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH
+    "Public header install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
+set(FLTK_DATADIR ${CMAKE_INSTALL_DATADIR} CACHE PATH
+    "Non-arch data install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
+set(FLTK_MANDIR ${CMAKE_INSTALL_MANDIR} CACHE PATH
+    "Manual install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
+
+
 #######################################################################
 # platform dependent information
 #######################################################################
@@ -58,9 +83,9 @@
    set(FLTK_CONFIG_PATH FLTK/.framework/Resources/CMake)
    set(FLTK_EXAMPLES_PATH share/fltk-examples)
 else()
-   set(FLTK_CONFIG_PATH lib/fltk)
-   set(FLTK_EXAMPLES_PATH share/fltk-examples)
-endif(WIN32 AND NOT CYGWIN)
+   set(FLTK_CONFIG_PATH ${FLTK_LIBDIR}/fltk)
+   set(FLTK_EXAMPLES_PATH ${FLTK_DATADIR}/fltk-examples)
+endif()
 
 include(TestBigEndian)
 TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 10462)
+++ CMakeLists.txt	(working copy)
@@ -50,7 +50,7 @@
 include(CMake/export.cmake)
 
 #######################################################################
-# build examples - these have to be after fluid is built/imported
+# build examples - these have to be built after fluid is built/imported
 #######################################################################
 if(OPTION_BUILD_EXAMPLES)
    add_subdirectory(test)
Index: fltk-config.cmake.in
===================================================================
--- fltk-config.cmake.in	(revision 10462)
+++ fltk-config.cmake.in	(working copy)
@@ -31,9 +31,9 @@
 prefix=@CMAKE_INSTALL_PREFIX@
 exec_prefix=${prefix}
 exec_prefix_set=no
-bindir=@PREFIX_BIN@
-includedir=@PREFIX_INCLUDE@
-libdir=@PREFIX_LIB@
+bindir=@FLTK_FULL_BINDIR@
+includedir=@FLTK_FULL_INCLUDEDIR@
+libdir=@FLTK_FULL_LIBDIR@
 srcdir=.
 
 # compiler names
Index: fluid/CMakeLists.txt
===================================================================
--- fluid/CMakeLists.txt	(revision 10462)
+++ fluid/CMakeLists.txt	(working copy)
@@ -35,7 +35,26 @@
 
 install(TARGETS fluid
     EXPORT FLTK-Targets
-    RUNTIME DESTINATION bin
-    LIBRARY DESTINATION lib
-    ARCHIVE DESTINATION lib
+    RUNTIME DESTINATION ${FLTK_BINDIR}
+    LIBRARY DESTINATION ${FLTK_LIBDIR}
+    ARCHIVE DESTINATION ${FLTK_LIBDIR}
     )
+
+if(UNIX)
+    install(FILES fluid.desktop
+        DESTINATION ${FLTK_DATADIR}/applications
+        )
+    # Install mime-type file. x-fluid.desktop method is depreciated.
+    install(FILES fluid.xml
+        DESTINATION ${FLTK_DATADIR}/mime/packages
+        )
+
+    # Install desktop icons.
+    set(_icons 32;48;64;128)
+    foreach(icon ${_icons})
+        install(FILES icons/fluid-${icon}.png
+            DESTINATION ${FLTK_DATADIR}/icons/hicolor/${icon}x${icon}/apps
+            RENAME fluid.png
+        )
+    endforeach()
+endif()
Index: fluid/fluid.desktop
===================================================================
--- fluid/fluid.desktop	(revision 10462)
+++ fluid/fluid.desktop	(working copy)
@@ -6,5 +6,5 @@
 Icon=fluid
 Terminal=false
 Type=Application
-MimeType=application/x-fluid
+MimeType=application/x-fluid;
 Categories=Development;GUIDesigner;
Index: fluid/fluid.xml
===================================================================
--- fluid/fluid.xml	(revision 0)
+++ fluid/fluid.xml	(working copy)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+  <mime-type type="application/x-fluid">
+         <comment>FLUID GUI Design</comment>
+         <glob pattern="*.fl"/>
+  </mime-type>
+</mime-info>
Index: fluid/x-fluid.desktop
===================================================================
--- fluid/x-fluid.desktop	(revision 10462)
+++ fluid/x-fluid.desktop	(working copy)
@@ -1,8 +0,0 @@
-[Desktop Entry]
-Type=MimeType
-MimeType=application/x-fluid
-Icon=fluid.png
-Patterns=*.fl
-Name=FLUID
-Comment=FLUID GUI Design
-Encoding=UTF-8
