diff -Naurx.svn fltk-1.3/CMake/export.cmake fixMac/CMake/export.cmake
--- fltk-1.3/CMake/export.cmake	2016-05-10 06:44:24.690382772 -0400
+++ fixMac/CMake/export.cmake	2016-05-10 06:54:20.891434157 -0400
@@ -44,6 +44,13 @@
 # generate FLTK-Targets.cmake for build directory use
 export(TARGETS ${FLUID} ${FLTK_LIBRARIES} FILE ${CMAKE_BINARY_DIR}/FLTK-Targets.cmake)
 
+# generate FLTK-Functions.cmake for build directory use
+configure_file(
+    ${FLTK_SOURCE_DIR}/CMake/FLTK-Functions.cmake
+    ${FLTK_BINARY_DIR}/FLTK-Functions.cmake
+    COPYONLY
+    )
+
 # generate FLTKConfig.cmake for build directory use
 set(INCLUDE_DIRS "${FLTK_INCLUDE_DIRS}")
 set(CONFIG_PATH ${FLTK_BINARY_DIR})
diff -Naurx.svn fltk-1.3/CMake/FLTK-Functions.cmake fixMac/CMake/FLTK-Functions.cmake
--- fltk-1.3/CMake/FLTK-Functions.cmake	1969-12-31 19:00:00.000000000 -0500
+++ fixMac/CMake/FLTK-Functions.cmake	2016-05-10 06:51:28.190977130 -0400
@@ -0,0 +1,49 @@
+#
+# "$Id$"
+#
+# FLTK-Functions.cmake
+# Written by Michael Surette
+#
+# Copyright 1998-2016 by Bill Spitzak and others.
+#
+# This library is free software. Distribution and use rights are outlined in
+# the file "COPYING" which should have been included with this file.  If this
+# file is missing or damaged, see the license at:
+#
+#     http://www.fltk.org/COPYING.php
+#
+# Please report all bugs and problems on the following page:
+#
+#     http://www.fltk.org/str.php
+#
+
+#######################################################################
+# functions used by the build system and exported for the end-user
+#######################################################################
+# USAGE: FLTK_RUN_FLUID TARGET_NAME "FLUID_SOURCE [.. FLUID_SOURCE]"
+function(FLTK_RUN_FLUID TARGET SOURCES)
+    set (CXX_FILES)
+    foreach(src ${SOURCES})
+        if ("${src}" MATCHES "\\.fl$")
+            string(REGEX REPLACE "(.*).fl" \\1 basename ${src})
+            add_custom_command(
+                OUTPUT "${basename}.cxx" "${basename}.h"
+                COMMAND "${FLTK_FLUID_EXECUTABLE}" -c ${CMAKE_CURRENT_SOURCE_DIR}/${src}
+                DEPENDS ${src}
+                MAIN_DEPENDENCY ${src}
+            )
+            list(APPEND CXX_FILES "${basename}.cxx")
+        endif ("${src}" MATCHES "\\.fl$")
+        set (${TARGET} ${CXX_FILES} PARENT_SCOPE)
+    endforeach(src)
+endfunction(FLTK_RUN_FLUID TARGET SOURCES)
+
+#######################################################################
+# sets the bundle icon for OSX bundles
+function(FLTK_SET_BUNDLE_ICON TARGET ICON_PATH)
+    get_filename_component(ICON_NAME "${ICON_PATH}" NAME)
+    set_target_properties("${TARGET}" PROPERTIES
+        MACOSX_BUNDLE_ICON_FILE "${ICON_NAME}"
+        RESOURCE "${ICON_PATH}"
+    )
+endfunction(FLTK_SET_BUNDLE_ICON TARGET ICON_PATH)
diff -Naurx.svn fltk-1.3/CMake/install.cmake fixMac/CMake/install.cmake
--- fltk-1.3/CMake/install.cmake	2016-05-10 06:44:24.690382772 -0400
+++ fixMac/CMake/install.cmake	2016-05-10 06:53:52.299352721 -0400
@@ -60,8 +60,10 @@
    @ONLY
 )
 
-install(FILES ${FLTK_BINARY_DIR}/etc/FLTKConfig.cmake
-   DESTINATION ${FLTK_CONFIG_PATH}
+install(FILES
+    ${FLTK_BINARY_DIR}/etc/FLTKConfig.cmake
+    ${FLTK_SOURCE_DIR}/CMake/FLTK-Functions.cmake
+    DESTINATION ${FLTK_CONFIG_PATH}
 )
 
 configure_file(
diff -Naurx.svn fltk-1.3/CMake/macros.cmake fixMac/CMake/macros.cmake
--- fltk-1.3/CMake/macros.cmake	2016-05-10 06:44:24.690382772 -0400
+++ fixMac/CMake/macros.cmake	2016-05-10 22:51:24.891002366 -0400
@@ -1,7 +1,7 @@
 #
 # "$Id: macros.cmake 11442 2016-03-27 16:56:23Z AlbrechtS $"
 #
-# macros.cmake defines macros used by the build system
+# macros.cmake
 # Written by Michael Surette
 #
 # Copyright 1998-2016 by Bill Spitzak and others.
@@ -82,32 +82,13 @@
 endmacro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
 
 #######################################################################
-# USAGE: FLTK_RUN_FLUID TARGET_NAME "FLUID_SOURCE [.. FLUID_SOURCE]"
-function(FLTK_RUN_FLUID TARGET SOURCES)
-    set (CXX_FILES)
-    foreach(src ${SOURCES})
-        if ("${src}" MATCHES "\\.fl$")
-	    string(REGEX REPLACE "(.*).fl" \\1 basename ${src})
-	    add_custom_command(
-		OUTPUT "${basename}.cxx" "${basename}.h"
-		COMMAND fluid -c ${CMAKE_CURRENT_SOURCE_DIR}/${src}
-		DEPENDS ${src}
-		MAIN_DEPENDENCY ${src}
-		)
-	    list(APPEND CXX_FILES "${basename}.cxx")
-        endif ("${src}" MATCHES "\\.fl$")
-        set (${TARGET} ${CXX_FILES} PARENT_SCOPE)
-    endforeach(src)
-endfunction(FLTK_RUN_FLUID TARGET SOURCES)
-
-#######################################################################
-macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
+function(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
 
     set (srcs)			# source files
     set (flsrcs)		# fluid source files
+    set (icns)          # mac icons
 
     set (tname ${NAME})		# target name
-    set (oname ${NAME})		# output (executable) name
 
     # rename reserved target name "help" (CMake 2.8.12 and later)
     if (${tname} MATCHES "^help$")
@@ -117,6 +98,8 @@
     foreach(src ${SOURCES})
         if ("${src}" MATCHES "\\.fl$")
             list(APPEND flsrcs ${src})
+        elseif ("${src}" MATCHES "\\.icns$")
+            set(icns "${src}")
         else ()
             list(APPEND srcs ${src})
         endif ("${src}" MATCHES "\\.fl$")
@@ -124,45 +107,24 @@
 
     set (FLUID_SOURCES)
     if (flsrcs)
-	FLTK_RUN_FLUID(FLUID_SOURCES "${flsrcs}")
+        FLTK_RUN_FLUID(FLUID_SOURCES "${flsrcs}")
     endif (flsrcs)
 
     if (APPLE AND NOT OPTION_APPLE_X11)
-      unset (RESOURCE_PATH)
-      if (${tname} STREQUAL "blocks" OR ${tname} STREQUAL "checkers" OR ${tname} STREQUAL "sudoku")
-        set (ICON_NAME ${tname}.icns)
-        set (RESOURCE_PATH "${PROJECT_SOURCE_DIR}/test/${tname}.app/Contents/Resources/${ICON_NAME}")
-      elseif (${tname} STREQUAL "demo")
-        set (RESOURCE_PATH "${PROJECT_SOURCE_DIR}/test/demo.menu")
-      endif (${tname} STREQUAL "blocks" OR ${tname} STREQUAL "checkers" OR ${tname} STREQUAL "sudoku")
-
-      if (DEFINED RESOURCE_PATH)
-        add_executable(${tname} MACOSX_BUNDLE ${srcs} ${FLUID_SOURCES} ${RESOURCE_PATH})
-        if (${tname} STREQUAL "demo")
-          target_compile_definitions(demo PUBLIC USING_XCODE)
-        endif (${tname} STREQUAL "demo")
-      else ()
-        add_executable(${tname} MACOSX_BUNDLE ${srcs} ${FLUID_SOURCES})
-      endif (DEFINED RESOURCE_PATH)
+        add_executable(${tname} MACOSX_BUNDLE ${srcs} ${FLUID_SOURCES} ${icns})
+        if (icns)
+            FLTK_SET_BUNDLE_ICON(${tname} ${icns})
+        endif (icns)
     else ()
-      add_executable(${tname} WIN32 ${srcs} ${FLUID_SOURCES})
+        add_executable(${tname} WIN32 ${srcs} ${FLUID_SOURCES})
     endif (APPLE AND NOT OPTION_APPLE_X11)
 
     set_target_properties(${tname}
-      PROPERTIES OUTPUT_NAME ${oname}
+        PROPERTIES OUTPUT_NAME ${NAME}
     )
-    if (APPLE AND DEFINED RESOURCE_PATH)
-      if (NOT ${tname} STREQUAL "demo")
-        set_target_properties(${tname} PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
-      endif (NOT ${tname} STREQUAL "demo")
-      set_target_properties(${tname} PROPERTIES RESOURCE ${RESOURCE_PATH})
-    endif (APPLE AND DEFINED RESOURCE_PATH)
-    if (APPLE AND (NOT OPTION_APPLE_X11) AND ${tname} STREQUAL "editor")
-      set_target_properties("editor" PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/ide/Xcode4/plists/editor-Info.plist")
-    endif (APPLE AND (NOT OPTION_APPLE_X11) AND ${tname} STREQUAL "editor")
 
     target_link_libraries(${tname} ${LIBRARIES})
 
-endmacro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
+endfunction(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
 
 #######################################################################
diff -Naurx.svn fltk-1.3/CMakeLists.txt fixMac/CMakeLists.txt
--- fltk-1.3/CMakeLists.txt	2016-05-10 06:45:39.814412726 -0400
+++ fixMac/CMakeLists.txt	2016-05-10 20:01:28.014262518 -0400
@@ -25,8 +25,9 @@
 cmake_minimum_required(VERSION 2.6.3)
 
 #######################################################################
-# define some macros
+# define some functions and macros
 #######################################################################
+include(CMake/FLTK-Functions.cmake)
 include(CMake/macros.cmake)
 
 #######################################################################
diff -Naurx.svn fltk-1.3/fluid/CMakeLists.txt fixMac/fluid/CMakeLists.txt
--- fltk-1.3/fluid/CMakeLists.txt	2016-05-10 06:46:16.622441747 -0400
+++ fixMac/fluid/CMakeLists.txt	2016-05-10 21:56:29.042345926 -0400
@@ -39,31 +39,21 @@
 )
 
 if(APPLE AND NOT OPTION_APPLE_X11)
-  set( ICON_NAME fluid.icns )
-  set( ICON_PATH "${PROJECT_SOURCE_DIR}/fluid/Fluid.app/Contents/Resources/${ICON_NAME}" )
-  add_executable(fluid MACOSX_BUNDLE ${CPPFILES} ${ICON_PATH})
+    set(FLUID_ICON "${CMAKE_CURRENT_SOURCE_DIR}/Fluid.app/Contents/Resources/fluid.icns")
+    add_executable(fluid MACOSX_BUNDLE ${CPPFILES} "${FLUID_ICON}")
+    FLTK_SET_BUNDLE_ICON(fluid "${FLUID_ICON}")
 else()
-  add_executable(fluid ${CPPFILES})
+    add_executable(fluid WIN32 ${CPPFILES})
 endif(APPLE AND NOT OPTION_APPLE_X11)
 
 target_link_libraries(fluid fltk fltk_images fltk_forms)
 
 # install fluid
 
-if(APPLE AND NOT OPTION_APPLE_X11)
-  # create bundle
-  set_target_properties(fluid PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
-  set_target_properties(fluid PROPERTIES RESOURCE ${ICON_PATH})
-  # install
-  install(TARGETS fluid DESTINATION ${FLTK_BINDIR})
-else()
-  install(TARGETS fluid
+install(TARGETS fluid
     EXPORT FLTK-Targets
-    RUNTIME DESTINATION ${FLTK_BINDIR}
-    LIBRARY DESTINATION ${FLTK_LIBDIR}
-    ARCHIVE DESTINATION ${FLTK_LIBDIR}
-    )
-endif(APPLE AND NOT OPTION_APPLE_X11)
+    DESTINATION ${FLTK_BINDIR}
+)
 
 # install desktop files
 
diff -Naurx.svn fltk-1.3/test/CMakeLists.txt fixMac/test/CMakeLists.txt
--- fltk-1.3/test/CMakeLists.txt	2016-05-10 06:45:43.250415056 -0400
+++ fixMac/test/CMakeLists.txt	2016-05-10 20:52:46.948138233 -0400
@@ -17,26 +17,45 @@
   )
 
 #######################################################################
+if (CMAKE_GENERATOR STREQUAL Xcode AND NOT OPTION_APPLE_X11)
+    add_definitions(-DUSING_XCODE)
+endif(CMAKE_GENERATOR STREQUAL Xcode AND NOT OPTION_APPLE_X11)
+
+#######################################################################
 CREATE_EXAMPLE(adjuster adjuster.cxx fltk)
 CREATE_EXAMPLE(arc arc.cxx fltk)
 CREATE_EXAMPLE(animated animated.cxx fltk)
 CREATE_EXAMPLE(ask ask.cxx fltk)
 CREATE_EXAMPLE(bitmap bitmap.cxx fltk)
-CREATE_EXAMPLE(blocks blocks.cxx "fltk;${AUDIOLIBS}")
+
+set(BLOCKS_ICON "${CMAKE_CURRENT_SOURCE_DIR}/blocks.app/Contents/Resources/blocks.icns")
+CREATE_EXAMPLE(blocks "blocks.cxx;${BLOCKS_ICON}" "fltk;${AUDIOLIBS}")
+
 CREATE_EXAMPLE(boxtype boxtype.cxx fltk)
 CREATE_EXAMPLE(browser browser.cxx fltk)
 CREATE_EXAMPLE(button button.cxx fltk)
 CREATE_EXAMPLE(buttons buttons.cxx fltk)
-CREATE_EXAMPLE(checkers checkers.cxx fltk)
+
+set(CHECKERS_ICON "${CMAKE_CURRENT_SOURCE_DIR}/checkers.app/Contents/Resources/checkers.icns")
+CREATE_EXAMPLE(checkers "checkers.cxx;${CHECKERS_ICON}" fltk)
+
 CREATE_EXAMPLE(clock clock.cxx fltk)
 CREATE_EXAMPLE(colbrowser colbrowser.cxx "fltk;fltk_forms")
 CREATE_EXAMPLE(color_chooser color_chooser.cxx fltk)
 CREATE_EXAMPLE(cursor cursor.cxx fltk)
 CREATE_EXAMPLE(curve curve.cxx fltk)
+
 CREATE_EXAMPLE(demo demo.cxx fltk)
+set_target_properties(demo PROPERTIES RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/demo.menu")
+
 CREATE_EXAMPLE(device device.cxx fltk)
 CREATE_EXAMPLE(doublebuffer doublebuffer.cxx fltk)
+
 CREATE_EXAMPLE(editor editor.cxx fltk)
+set_target_properties(editor PROPERTIES 
+    MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/ide/Xcode4/plists/editor-Info.plist"
+    )
+
 CREATE_EXAMPLE(fast_slow fast_slow.fl fltk)
 CREATE_EXAMPLE(file_chooser file_chooser.cxx "fltk;fltk_images")
 CREATE_EXAMPLE(fonts fonts.cxx fltk)
@@ -72,7 +91,10 @@
 CREATE_EXAMPLE(rotated_text rotated_text.cxx fltk)
 CREATE_EXAMPLE(scroll scroll.cxx fltk)
 CREATE_EXAMPLE(subwindow subwindow.cxx fltk)
-CREATE_EXAMPLE(sudoku sudoku.cxx "fltk;fltk_images;${AUDIOLIBS}")
+
+set(SUDOKU_ICON "${CMAKE_CURRENT_SOURCE_DIR}/sudoku.app/Contents/Resources/sudoku.icns")
+CREATE_EXAMPLE(sudoku "sudoku.cxx;${SUDOKU_ICON}" "fltk;fltk_images;${AUDIOLIBS}")
+
 CREATE_EXAMPLE(symbols symbols.cxx fltk)
 CREATE_EXAMPLE(tabs tabs.fl fltk)
 CREATE_EXAMPLE(table table.cxx fltk)
