diff --git a/CMake/macros.cmake b/CMake/macros.cmake
index 057c267..269011f 100644
--- a/CMake/macros.cmake
+++ b/CMake/macros.cmake
@@ -109,11 +109,6 @@ macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
     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$")
-        set (tname "test_help")
-    endif (${tname} MATCHES "^help$")
-
     foreach(src ${SOURCES})
         if ("${src}" MATCHES "\\.fl$")
             list(APPEND flsrcs ${src})
@@ -127,42 +122,48 @@ macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
 	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)
-    else ()
-      add_executable(${tname} WIN32 ${srcs} ${FLUID_SOURCES})
-    endif (APPLE AND NOT OPTION_APPLE_X11)
-
     set_target_properties(${tname}
       PROPERTIES OUTPUT_NAME ${oname}
     )
-    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)
 
 #######################################################################
+# called for Mac bundle handling
+macro(FL_ADD_BUNDLE NAME RESOURCE_FILES plist DEFINITIONS)
+    if(APPLE AND NOT OPTION_APPLE_X11)
+        set_target_properties(${NAME}
+            PROPERTIES MACOSX_BUNDLE TRUE
+        )
+
+        set(ICON_NAME "${NAME}.icns")
+
+        if(RESOURCE_FILES)
+            set_target_properties(${NAME}
+                PROPERTIES RESOURCE "${RESOURCE_FILES}"
+            )
+            set(RESOURCE_LIST "${RESOURCE_FILES}")
+            foreach(RESOURCE_FILE IN LISTS RESOURCE_LIST)
+                get_filename_component(RESOURCE_PATH "${RESOURCE_FILE}" DIRECTORY)
+                include_directories("${RESOURCE_PATH}")
+
+                find_file(ICON_FILE "${ICON_NAME}" "${RESOURCE_PATH}")
+                if(ICON_FILE)
+                    set_target_properties("${NAME}" PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
+                endif(ICON_FILE)
+            endforeach(RESOURCE_FILE IN LISTS RESOURCE_LIST)
+        endif(RESOURCE_FILES)
+
+        if(DEFINITIONS)
+            target_compile_definitions(${NAME} "${DEFINITIONS}")
+        endif(DEFINITIONS)
+
+        if(plist)
+        set_target_properties(${NAME}
+            PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${plist}")
+        endif(plist)
+        
+    endif(APPLE AND NOT OPTION_APPLE_X11)
+endmacro(FL_ADD_BUNDLE NAME RESOURCE_FILES plist DEFINITIONS)
diff --git a/fluid/CMakeLists.txt b/fluid/CMakeLists.txt
index 3320c1c..0844c13 100644
--- a/fluid/CMakeLists.txt
+++ b/fluid/CMakeLists.txt
@@ -38,32 +38,18 @@ set(CPPFILES
     widget_panel.cxx
 )
 
-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})
-else()
-  add_executable(fluid ${CPPFILES})
-endif(APPLE AND NOT OPTION_APPLE_X11)
+add_executable(fluid ${CPPFILES})
+FL_ADD_BUNDLE(fluid ./Fluid.app/Contents/Resources)
 
 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)
 
 # install desktop files
 
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 08a5cbc..783359c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -23,17 +23,20 @@ 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}")
+FL_ADD_BUNDLE(blocks "../test/blocks.app/Contents/Resources/blocks.icns")
 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)
+FL_ADD_BUNDLE(checkers "../test/checkers.app/Contents/Resources/checkers.icns")
 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;fltk_forms")
+FL_ADD_BUNDLE(demo "../test/demo.menu" "" "PUBLIC USING_XCODE")
 CREATE_EXAMPLE(device device.cxx fltk)
 CREATE_EXAMPLE(doublebuffer doublebuffer.cxx fltk)
 CREATE_EXAMPLE(editor editor.cxx fltk)
@@ -42,7 +45,8 @@ CREATE_EXAMPLE(file_chooser file_chooser.cxx "fltk;fltk_images")
 CREATE_EXAMPLE(fonts fonts.cxx fltk)
 CREATE_EXAMPLE(forms forms.cxx "fltk;fltk_forms")
 CREATE_EXAMPLE(hello hello.cxx fltk)
-CREATE_EXAMPLE(help help.cxx "fltk;fltk_images")
+# rename reserved target name "help" (CMake 2.8.12 and later)
+CREATE_EXAMPLE(test_help help.cxx "fltk;fltk_images")
 CREATE_EXAMPLE(icon icon.cxx fltk)
 CREATE_EXAMPLE(iconize iconize.cxx fltk)
 CREATE_EXAMPLE(image image.cxx fltk)
@@ -73,6 +77,7 @@ 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}")
+FL_ADD_BUNDLE(sudoku "../test/sudoku.app/Contents/Resources/sudoku.icns")
 CREATE_EXAMPLE(symbols symbols.cxx fltk)
 CREATE_EXAMPLE(tabs tabs.fl fltk)
 CREATE_EXAMPLE(table table.cxx fltk)
