--- GetPrerequisites.cmake.orig	2012-06-05 17:55:32.000000000 +0200
+++ GetPrerequisites.cmake	2012-06-05 17:55:17.000000000 +0200
@@ -142,11 +142,11 @@
   set(${result_var} 0 PARENT_SCOPE)
 
   get_filename_component(file_full "${file}" ABSOLUTE)
-  string(TOLOWER "${file_full}" file_full_lower)
 
   # If file name ends in .exe on Windows, *assume* executable:
   #
   if(WIN32 AND NOT UNIX)
+    string(TOLOWER "${file_full}" file_full_lower)
     if("${file_full_lower}" MATCHES "\\.exe$")
       set(${result_var} 1 PARENT_SCOPE)
       return()
@@ -158,6 +158,41 @@
     #
   endif(WIN32 AND NOT UNIX)
 
+  # Use the information returned from the Unix shell command "otool -hv" to
+  # determine if ${file_full} should be considered an executable file...
+  #
+  # If the otool command's output contains "EXECUTE" then it is a Mach-O
+  # executable suitable for prerequisite analysis via the get_prerequisites
+  # macro.
+  #
+  if(APPLE)
+    if(NOT otool_cmd)
+      find_program(otool_cmd "otool")
+    endif(NOT otool_cmd)
+
+    if(otool_cmd)
+      execute_process(COMMAND "${otool_cmd}" -hv "${file_full}"
+        OUTPUT_VARIABLE otool_ov
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        )
+
+      # Replace the name of the file in the output with a placeholder token
+      # (the string " _file_full_ ") so that just in case the path name of
+      # the file contains the word "EXECUTE" we are not fooled into thinking
+      # "the wrong thing" because the file name matches the other 'otool'
+      # command output we are looking for...
+      #
+      string(REPLACE "${file_full}" " _file_full_ " otool_ov "${otool_ov}")
+
+      if("${otool_ov}" MATCHES "EXECUTE")
+        set(${result_var} 1 PARENT_SCOPE)
+      endif("${otool_ov}" MATCHES "EXECUTE")
+    else(otool_cmd)
+      message(STATUS "warning: No 'otool' command, skipping execute_process...")
+    endif(otool_cmd)
+    return()
+  endif(APPLE)
+
   # Use the information returned from the Unix shell command "file" to
   # determine if ${file_full} should be considered an executable file...
   #
