[Cmake-commits] CMake branch, next, updated. v2.8.2-534-g095fb5b

David Cole david.cole at kitware.com
Wed Aug 25 15:01:57 EDT 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  095fb5bf2d6184faa6997ac70991a6f13ad5eed8 (commit)
       via  90add6b50436070605975b0c8188d4fe4b9ddbfa (commit)
       via  af0c719b9a95706095b79796239f0730d3883cd6 (commit)
       via  c4f7034efb1ded09f3a2ca2915c9a6f1766ddf4b (commit)
       via  51cc86167b91a187bff816dd4ddf39503fc4ca51 (commit)
       via  f811470a964147fefc6e09ddcf71545e3cce24a7 (commit)
      from  f1f632cc93251bdba9120c4213bda56f47fb93ba (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=095fb5bf2d6184faa6997ac70991a6f13ad5eed8
commit 095fb5bf2d6184faa6997ac70991a6f13ad5eed8
Merge: f1f632c 90add6b
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Wed Aug 25 15:01:49 2010 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Aug 25 15:01:49 2010 -0400

    Merge topic 'fix-10747' into next
    
    90add6b Refine formatting for cmake --help-module output.
    af0c719 Merge branch 'patches/docBundleUtilities'
    c4f7034 KWSys Nightly Date Stamp
    51cc861 Improve documentation of GetPrerequisites.cmake
    f811470 Improve documentation of BundleUtilities.cmake


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90add6b50436070605975b0c8188d4fe4b9ddbfa
commit 90add6b50436070605975b0c8188d4fe4b9ddbfa
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Wed Aug 25 14:58:31 2010 -0400
Commit:     David Cole <david.cole at kitware.com>
CommitDate: Wed Aug 25 14:58:31 2010 -0400

    Refine formatting for cmake --help-module output.
    
    Also refer to self as module, not script.

diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 2e23ab6..b48c61e 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -1,4 +1,5 @@
-# - A collection of CMake utility functions useful for dealing with .app
+# - Functions to help assemble a standalone bundle application.
+# A collection of CMake utility functions useful for dealing with .app
 # bundles on the Mac and bundle-like directories on any OS.
 #
 # The following functions are provided by this module:
@@ -18,7 +19,6 @@
 #   fixup_bundle_item
 #   verify_bundle_prerequisites
 #   verify_bundle_symlinks
-#
 # Requires CMake 2.6 or greater because it uses function, break and
 # PARENT_SCOPE. Also depends on GetPrerequisites.cmake.
 #
@@ -127,7 +127,6 @@
 # Verifies that any symlinks found in the bundle point to other files that are
 # already also in the bundle... Anything that points to an external file causes
 # this function to fail the verification.
-#
 
 #=============================================================================
 # Copyright 2008-2009 Kitware, Inc.
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index f6b3a54..847db34 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -1,11 +1,12 @@
-# - This script provides functions to list the .dll, .dylib or .so files that
-# an executable or shared library file depends on. (Its prerequisites.)
+# - Functions to analyze and list executable file prerequisites.
+# This module provides functions to list the .dll, .dylib or .so
+# files that an executable or shared library file depends on. (Its
+# prerequisites.)
 #
 # It uses various tools to obtain the list of required shared library files:
 #   dumpbin (Windows)
 #   ldd (Linux/Unix)
 #   otool (Mac OSX)
-#
 # The following functions are provided by this module:
 #   get_prerequisites
 #   list_prerequisites
@@ -19,7 +20,6 @@
 #   gp_resolved_file_type
 #     (projects can override with gp_resolved_file_type_override)
 #   gp_file_type
-#
 # Requires CMake 2.6 or greater because it uses function, break, return and
 # PARENT_SCOPE.
 #
@@ -93,7 +93,6 @@
 #   local
 #   embedded
 #   other
-#
 # Override on a per-project basis by providing a project-specific
 # gp_resolved_file_type_override function.
 #
@@ -106,7 +105,6 @@
 #   local
 #   embedded
 #   other
-#
 
 #=============================================================================
 # Copyright 2008-2009 Kitware, Inc.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=af0c719b9a95706095b79796239f0730d3883cd6
commit af0c719b9a95706095b79796239f0730d3883cd6
Merge: c4f7034 51cc861
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Wed Aug 25 14:54:14 2010 -0400
Commit:     David Cole <david.cole at kitware.com>
CommitDate: Wed Aug 25 14:54:14 2010 -0400

    Merge branch 'patches/docBundleUtilities'
    
    of http://github.com/themiwi/CMake
    into fix-10747
    
    Conflicts:
    	Modules/BundleUtilities.cmake
    
    There was one newly added function in BundleUtilities.cmake
    which also needed the same "documentation at top" treatment.

diff --cc Modules/BundleUtilities.cmake
index 7690094,136171f..2e23ab6
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@@ -13,16 -14,109 +14,120 @@@
  #   set_bundle_key_values
  #   get_bundle_keys
  #   copy_resolved_item_into_bundle
 +#   copy_resolved_framework_into_bundle
  #   fixup_bundle_item
- #   fixup_bundle
- #   copy_and_fixup_bundle
  #   verify_bundle_prerequisites
  #   verify_bundle_symlinks
  #
  # Requires CMake 2.6 or greater because it uses function, break and
  # PARENT_SCOPE. Also depends on GetPrerequisites.cmake.
+ #
+ #  FIXUP_BUNDLE(<app> <libs> <dirs>)
+ # Fix up a bundle in-place and make it standalone, such that it can be
+ # drag-n-drop copied to another machine and run on that machine as long as all
+ # of the system libraries are compatible.
+ #
+ # Gather all the keys for all the executables and libraries in a bundle, and
+ # then, for each key, copy each prerequisite into the bundle. Then fix each one
+ # up according to its own list of prerequisites.
+ #
+ # Then clear all the keys and call verify_app on the final bundle to ensure
+ # that it is truly standalone.
+ #
+ #  COPY_AND_FIXUP_BUNDLE(<src> <dst> <libs> <dirs>)
+ # Makes a copy of the bundle <src> at location <dst> and then fixes up the
+ # new copied bundle in-place at <dst>...
+ #
+ #  VERIFY_APP(<app>)
+ # Verifies that an application <app> appears valid based on running analysis
+ # tools on it. Calls "message(FATAL_ERROR" if the application is not verified.
+ #
+ #  GET_BUNDLE_MAIN_EXECUTABLE(<bundle> <result_var>)
+ # The result will be the full path name of the bundle's main executable file
+ # or an "error:" prefixed string if it could not be determined.
+ #
+ #  GET_DOTAPP_DIR(<exe> <dotapp_dir_var>)
+ # Returns the nearest parent dir whose name ends with ".app" given the full
+ # path to an executable. If there is no such parent dir, then return a dir at
+ # the same level as the executable, named with the executable's base name and
+ # ending with ".app"
+ #
+ # The returned directory may or may not exist.
+ #
+ #  GET_BUNDLE_AND_EXECUTABLE(<app> <bundle_var> <executable_var> <valid_var>)
+ # Takes either a ".app" directory name or the name of an executable
+ # nested inside a ".app" directory and returns the path to the ".app"
+ # directory in <bundle_var> and the path to its main executable in
+ # <executable_var>
+ #
+ #  GET_BUNDLE_ALL_EXECUTABLES(<bundle> <exes_var>)
+ # Scans the given bundle recursively for all executable files and accumulates
+ # them into a variable.
+ #
+ #  GET_ITEM_KEY(<item> <key_var>)
+ # Given a file (item) name, generate a key that should be unique considering
+ # the set of libraries that need copying or fixing up to make a bundle
+ # standalone. This is essentially the file name including extension with "."
+ # replaced by "_"
+ #
+ # This key is used as a prefix for CMake variables so that we can associate a
+ # set of variables with a given item based on its key.
+ #
+ #  CLEAR_BUNDLE_KEYS(<keys_var>)
+ # Loop over the list of keys, clearing all the variables associated with each
+ # key. After the loop, clear the list of keys itself.
+ #
+ # Caller of get_bundle_keys should call clear_bundle_keys when done with list
+ # of keys.
+ #
+ #  SET_BUNDLE_KEY_VALUES(<keys_var> <context> <item> <exepath> <dirs>
+ #                        <copyflag>)
+ # Add a key to the list (if necessary) for the given item. If added,
+ # also set all the variables associated with that key.
+ #
+ #  GET_BUNDLE_KEYS(<app> <libs> <dirs> <keys_var>)
+ # Loop over all the executable and library files within the bundle (and given
+ # as extra <libs>) and accumulate a list of keys representing them. Set
+ # values associated with each key such that we can loop over all of them and
+ # copy prerequisite libs into the bundle and then do appropriate
+ # install_name_tool fixups.
+ #
+ #  COPY_RESOLVED_ITEM_INTO_BUNDLE(<resolved_item> <resolved_embedded_item>)
+ # Copy a resolved item into the bundle if necessary. Copy is not necessary if
+ # the resolved_item is "the same as" the resolved_embedded_item.
+ #
++#  COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE(<resolved_item> <resolved_embedded_item>)
++# Copy a resolved framework into the bundle if necessary. Copy is not necessary
++# if the resolved_item is "the same as" the resolved_embedded_item.
++#
++# By default, BU_COPY_FULL_FRAMEWORK_CONTENTS is not set. If you want full
++# frameworks embedded in your bundles, set BU_COPY_FULL_FRAMEWORK_CONTENTS to
++# ON before calling fixup_bundle. By default,
++# COPY_RESOLVED_FRAMEWORK_INTO_BUNDLE copies the framework dylib itself plus
++# the framework Resources directory.
++#
+ #  FIXUP_BUNDLE_ITEM(<resolved_embedded_item> <exepath> <dirs>)
+ # Get the direct/non-system prerequisites of the resolved embedded item. For
+ # each prerequisite, change the way it is referenced to the value of the
+ # _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely changing to
+ # an "@executable_path" style reference.)
+ #
+ # Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM
+ # value.
+ #
+ # Accumulate changes in a local variable and make *one* call to
+ # install_name_tool at the end of the function with all the changes at once.
+ #
+ #  VERIFY_BUNDLE_PREREQUISITES(<bundle> <result_var> <info_var>)
+ # Verifies that the sum of all prerequisites of all files inside the bundle
+ # are contained within the bundle or are "system" libraries, presumed to exist
+ # everywhere.
+ #
+ #  VERIFY_BUNDLE_SYMLINKS(<bundle> <result_var> <info_var>)
+ # Verifies that any symlinks found in the bundle point to other files that are
+ # already also in the bundle... Anything that points to an external file causes
+ # this function to fail the verification.
+ #
  
  #=============================================================================
  # Copyright 2008-2009 Kitware, Inc.
@@@ -434,71 -467,6 +478,48 @@@ function(copy_resolved_item_into_bundl
  endfunction(copy_resolved_item_into_bundle)
  
  
- # copy_resolved_framework_into_bundle
- #
- # Copy a resolved framework into the bundle if necessary. Copy is not necessary
- # if the resolved_item is "the same as" the resolved_embedded_item.
- #
- # By default, BU_COPY_FULL_FRAMEWORK_CONTENTS is not set. If you want full
- # frameworks embedded in your bundles, set BU_COPY_FULL_FRAMEWORK_CONTENTS to
- # ON before calling fixup_bundle. By default,
- # copy_resolved_framework_into_bundle copies the framework dylib itself plus
- # any framework Resources.
- #
 +function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_item)
 +  if(WIN32)
 +    # ignore case on Windows
 +    string(TOLOWER "${resolved_item}" resolved_item_compare)
 +    string(TOLOWER "${resolved_embedded_item}" resolved_embedded_item_compare)
 +  else()
 +    set(resolved_item_compare "${resolved_item}")
 +    set(resolved_embedded_item_compare "${resolved_embedded_item}")
 +  endif()
 +
 +  if("${resolved_item_compare}" STREQUAL "${resolved_embedded_item_compare}")
 +    message(STATUS "warning: resolved_item == resolved_embedded_item - not copying...")
 +  else()
 +    if(BU_COPY_FULL_FRAMEWORK_CONTENTS)
 +      # Full Framework (everything):
 +      get_filename_component(resolved_dir "${resolved_item}" PATH)
 +      get_filename_component(resolved_dir "${resolved_dir}/../.." ABSOLUTE)
 +      get_filename_component(resolved_embedded_dir "${resolved_embedded_item}" PATH)
 +      get_filename_component(resolved_embedded_dir "${resolved_embedded_dir}/../.." ABSOLUTE)
 +      #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_dir}' '${resolved_embedded_dir}'")
 +      execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${resolved_dir}" "${resolved_embedded_dir}")
 +    else()
 +      # Framework lib itself:
 +      #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy ${resolved_item} ${resolved_embedded_item}")
 +      execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_item}" "${resolved_embedded_item}")
 +
 +      # Plus Resources, if they exist:
 +      string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Resources" resolved_resources "${resolved_item}")
 +      string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Resources" resolved_embedded_resources "${resolved_embedded_item}")
 +      if(EXISTS "${resolved_resources}")
 +        #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_resources}' '${resolved_embedded_resources}'")
 +        execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${resolved_resources}" "${resolved_embedded_resources}")
 +      endif()
 +    endif()
 +  endif()
 +
 +  if(UNIX AND NOT APPLE)
 +    file(RPATH_REMOVE FILE "${resolved_embedded_item}")
 +  endif(UNIX AND NOT APPLE)
 +endfunction(copy_resolved_framework_into_bundle)
 +
 +
- # fixup_bundle_item
- #
- # Get the direct/non-system prerequisites of the resolved embedded item. For each
- # prerequisite, change the way it is referenced to the value of the _EMBEDDED_ITEM
- # keyed variable for that prerequisite. (Most likely changing to an "@executable_path"
- # style reference.)
- #
- # Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM value.
- #
- # Accumulate changes in a local variable and make *one* call to install_name_tool
- # at the end of the function with all the changes at once.
- #
  function(fixup_bundle_item resolved_embedded_item exepath dirs)
    # This item's key is "ikey":
    #
diff --cc Modules/GetPrerequisites.cmake
index 17b32f6,3dcfa35..f6b3a54
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@@ -35,14 -118,9 +118,9 @@@
  # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  # See the License for more information.
  #=============================================================================
 -# (To distributed this file outside of CMake, substitute the full
 +# (To distribute this file outside of CMake, substitute the full
  #  License text for the above reference.)
  
- # gp_append_unique list_var value
- #
- # Append value to the list variable ${list_var} only if the value is not
- # already in the list.
- #
  function(gp_append_unique list_var value)
    set(contains 0)
  

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51cc86167b91a187bff816dd4ddf39503fc4ca51
commit 51cc86167b91a187bff816dd4ddf39503fc4ca51
Author:     Michael Wild <themiwi at users.sourceforge.net>
AuthorDate: Fri May 21 22:29:16 2010 +0200
Commit:     Michael Wild <themiwi at users.sourceforge.net>
CommitDate: Sun May 23 14:38:21 2010 +0200

    Improve documentation of GetPrerequisites.cmake
    
    Put the function documentation into the header-comment, improve
    formatting and list the user-relevant functions first.
    
    Signed-off-by: Michael Wild <themiwi at users.sourceforge.net>

diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 24cee55..3dcfa35 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -1,14 +1,15 @@
-# GetPrerequisites.cmake
-#
-# This script provides functions to list the .dll, .dylib or .so files that an
-# executable or shared library file depends on. (Its prerequisites.)
+# - This script provides functions to list the .dll, .dylib or .so files that
+# an executable or shared library file depends on. (Its prerequisites.)
 #
 # It uses various tools to obtain the list of required shared library files:
 #   dumpbin (Windows)
 #   ldd (Linux/Unix)
 #   otool (Mac OSX)
 #
-# The following functions are provided by this script:
+# The following functions are provided by this module:
+#   get_prerequisites
+#   list_prerequisites
+#   list_prerequisites_by_glob
 #   gp_append_unique
 #   is_file_executable
 #   gp_item_default_embedded_path
@@ -18,12 +19,94 @@
 #   gp_resolved_file_type
 #     (projects can override with gp_resolved_file_type_override)
 #   gp_file_type
-#   get_prerequisites
-#   list_prerequisites
-#   list_prerequisites_by_glob
 #
 # Requires CMake 2.6 or greater because it uses function, break, return and
 # PARENT_SCOPE.
+#
+#  GET_PREREQUISITES(<target> <prerequisites_var> <exclude_system> <recurse>
+#                    <dirs>)
+# Get the list of shared library files required by <target>. The list in
+# the variable named <prerequisites_var> should be empty on first entry to
+# this function. On exit, <prerequisites_var> will contain the list of
+# required shared library files.
+#
+# <target> is the full path to an executable file. <prerequisites_var> is the
+# name of a CMake variable to contain the results. <exclude_system> must be 0
+# or 1 indicating whether to include or exclude "system" prerequisites. If
+# <recurse> is set to 1 all prerequisites will be found recursively, if set to
+# 0 only direct prerequisites are listed. <exepath> is the path to the top
+# level executable used for @executable_path replacment on the Mac. <dirs> is
+# a list of paths where libraries might be found: these paths are searched
+# first when a target without any path info is given. Then standard system
+# locations are also searched: PATH, Framework locations, /usr/lib...
+#
+#  LIST_PREREQUISITES(<target> [<recurse> [<exclude_system> [<verbose>]]])
+# Print a message listing the prerequisites of <target>.
+#
+# <target> is the name of a shared library or executable target or the full
+# path to a shared library or executable file. If <recurse> is set to 1 all
+# prerequisites will be found recursively, if set to 0 only direct
+# prerequisites are listed. <exclude_system> must be 0 or 1 indicating whether
+# to include or exclude "system" prerequisites. With <verbose> set to 0 only
+# the full path names of the prerequisites are printed, set to 1 extra
+# informatin will be displayed.
+#
+#  LIST_PREREQUISITES_BY_GLOB(<glob_arg> <glob_exp>)
+# Print the prerequisites of shared library and executable files matching a
+# globbing pattern. <glob_arg> is GLOB or GLOB_RECURSE and <glob_exp> is a
+# globbing expression used with "file(GLOB" or "file(GLOB_RECURSE" to retrieve
+# a list of matching files. If a matching file is executable, its prerequisites
+# are listed.
+#
+# Any additional (optional) arguments provided are passed along as the
+# optional arguments to the list_prerequisites calls.
+#
+#  GP_APPEND_UNIQUE(<list_var> <value>)
+# Append <value> to the list variable <list_var> only if the value is not
+# already in the list.
+#
+#  IS_FILE_EXECUTABLE(<file> <result_var>)
+# Return 1 in <result_var> if <file> is a binary executable, 0 otherwise.
+#
+#  GP_ITEM_DEFAULT_EMBEDDED_PATH(<item> <default_embedded_path_var>)
+# Return the path that others should refer to the item by when the item
+# is embedded inside a bundle.
+#
+# Override on a per-project basis by providing a project-specific
+# gp_item_default_embedded_path_override function.
+#
+#  GP_RESOLVE_ITEM(<context> <item> <exepath> <dirs> <resolved_item_var>)
+# Resolve an item into an existing full path file.
+#
+# Override on a per-project basis by providing a project-specific
+# gp_resolve_item_override function.
+#
+#  GP_RESOLVED_FILE_TYPE(<original_file> <file> <exepath> <dirs> <type_var>)
+# Return the type of <file> with respect to <original_file>. String
+# describing type of prerequisite is returned in variable named <type_var>.
+#
+# Use <exepath> and <dirs> if necessary to resolve non-absolute <file>
+# values -- but only for non-embedded items.
+#
+# Possible types are:
+#   system
+#   local
+#   embedded
+#   other
+#
+# Override on a per-project basis by providing a project-specific
+# gp_resolved_file_type_override function.
+#
+#  GP_FILE_TYPE(<original_file> <file> <type_var>)
+# Return the type of <file> with respect to <original_file>. String
+# describing type of prerequisite is returned in variable named <type_var>.
+#
+# Possible types are:
+#   system
+#   local
+#   embedded
+#   other
+#
 
 #=============================================================================
 # Copyright 2008-2009 Kitware, Inc.
@@ -38,11 +121,6 @@
 # (To distributed this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-# gp_append_unique list_var value
-#
-# Append value to the list variable ${list_var} only if the value is not
-# already in the list.
-#
 function(gp_append_unique list_var value)
   set(contains 0)
 
@@ -59,12 +137,6 @@ function(gp_append_unique list_var value)
 endfunction(gp_append_unique)
 
 
-# is_file_executable file result_var
-#
-# Return 1 in ${result_var} if ${file} is a binary executable.
-#
-# Return 0 in ${result_var} otherwise.
-#
 function(is_file_executable file result_var)
   #
   # A file is not executable until proven otherwise:
@@ -132,14 +204,6 @@ function(is_file_executable file result_var)
 endfunction(is_file_executable)
 
 
-# gp_item_default_embedded_path item default_embedded_path_var
-#
-# Return the path that others should refer to the item by when the item
-# is embedded inside a bundle.
-#
-# Override on a per-project basis by providing a project-specific
-# gp_item_default_embedded_path_override function.
-#
 function(gp_item_default_embedded_path item default_embedded_path_var)
 
   # On Windows and Linux, "embed" prerequisites in the same directory
@@ -193,13 +257,6 @@ function(gp_item_default_embedded_path item default_embedded_path_var)
 endfunction(gp_item_default_embedded_path)
 
 
-# gp_resolve_item context item exepath dirs resolved_item_var
-#
-# Resolve an item into an existing full path file.
-#
-# Override on a per-project basis by providing a project-specific
-# gp_resolve_item_override function.
-#
 function(gp_resolve_item context item exepath dirs resolved_item_var)
   set(resolved 0)
   set(resolved_item "${item}")
@@ -332,23 +389,6 @@ warning: cannot resolve item '${item}'
 endfunction(gp_resolve_item)
 
 
-# gp_resolved_file_type original_file file exepath dirs type_var
-#
-# Return the type of ${file} with respect to ${original_file}. String
-# describing type of prerequisite is returned in variable named ${type_var}.
-#
-# Use ${exepath} and ${dirs} if necessary to resolve non-absolute ${file}
-# values -- but only for non-embedded items.
-#
-# Possible types are:
-#   system
-#   local
-#   embedded
-#   other
-#
-# Override on a per-project basis by providing a project-specific
-# gp_resolved_file_type_override function.
-#
 function(gp_resolved_file_type original_file file exepath dirs type_var)
   #message(STATUS "**")
 
@@ -445,17 +485,6 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
 endfunction()
 
 
-# gp_file_type original_file file type_var
-#
-# Return the type of ${file} with respect to ${original_file}. String
-# describing type of prerequisite is returned in variable named ${type_var}.
-#
-# Possible types are:
-#   system
-#   local
-#   embedded
-#   other
-#
 function(gp_file_type original_file file type_var)
   if(NOT IS_ABSOLUTE "${original_file}")
     message(STATUS "warning: gp_file_type expects absolute full path for first arg original_file")
@@ -470,30 +499,6 @@ function(gp_file_type original_file file type_var)
 endfunction(gp_file_type)
 
 
-# get_prerequisites target prerequisites_var exclude_system recurse dirs
-#
-# Get the list of shared library files required by ${target}. The list in
-# the variable named ${prerequisites_var} should be empty on first entry to
-# this function. On exit, ${prerequisites_var} will contain the list of
-# required shared library files.
-#
-#  target is the full path to an executable file
-#
-#  prerequisites_var is the name of a CMake variable to contain the results
-#
-#  exclude_system is 0 or 1: 0 to include "system" prerequisites , 1 to
-#   exclude them
-#
-#  recurse is 0 or 1: 0 for direct prerequisites only, 1 for all prerequisites
-#   recursively
-#
-#  exepath is the path to the top level executable used for @executable_path
-#   replacment on the Mac
-#
-#  dirs is a list of paths where libraries might be found: these paths are
-#   searched first when a target without any path info is given. Then standard
-#   system locations are also searched: PATH, Framework locations, /usr/lib...
-#
 function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs)
   set(verbose 0)
   set(eol_char "E")
@@ -706,19 +711,6 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
 endfunction(get_prerequisites)
 
 
-# list_prerequisites target all exclude_system verbose
-#
-#  ARGV0 (target) is the full path to an executable file
-#
-#  optional ARGV1 (all) is 0 or 1: 0 for direct prerequisites only,
-#   1 for all prerequisites recursively
-#
-#  optional ARGV2 (exclude_system) is 0 or 1: 0 to include "system"
-#   prerequisites , 1 to exclude them
-#
-#  optional ARGV3 (verbose) is 0 or 1: 0 to print only full path
-#   names of prerequisites, 1 to print extra information
-#
 function(list_prerequisites target)
   if("${ARGV1}" STREQUAL "")
     set(all 1)
@@ -771,17 +763,6 @@ function(list_prerequisites target)
 endfunction(list_prerequisites)
 
 
-# list_prerequisites_by_glob glob_arg glob_exp
-#
-#  glob_arg is GLOB or GLOB_RECURSE
-#
-#  glob_exp is a globbing expression used with "file(GLOB" to retrieve a list
-#   of matching files. If a matching file is executable, its prerequisites are
-#   listed.
-#
-# Any additional (optional) arguments provided are passed along as the
-# optional arguments to the list_prerequisites calls.
-#
 function(list_prerequisites_by_glob glob_arg glob_exp)
   message(STATUS "=============================================================================")
   message(STATUS "List prerequisites of executables matching ${glob_arg} '${glob_exp}'")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f811470a964147fefc6e09ddcf71545e3cce24a7
commit f811470a964147fefc6e09ddcf71545e3cce24a7
Author:     Michael Wild <themiwi at users.sourceforge.net>
AuthorDate: Fri May 21 22:29:16 2010 +0200
Commit:     Michael Wild <themiwi at users.sourceforge.net>
CommitDate: Sun May 23 14:38:20 2010 +0200

    Improve documentation of BundleUtilities.cmake
    
    Put the function documentation into the header-comment, improve
    formatting and list the user-relevant functions first.
    
    Signed-off-by: Michael Wild <themiwi at users.sourceforge.net>

diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index d9c41f4..136171f 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -1,9 +1,10 @@
-# BundleUtilities.cmake
+# - A collection of CMake utility functions useful for dealing with .app
+# bundles on the Mac and bundle-like directories on any OS.
 #
-# A collection of CMake utility functions useful for dealing with .app bundles
-# on the Mac and bundle-like directories on any OS.
-#
-# The following functions are provided by this script:
+# The following functions are provided by this module:
+#   fixup_bundle
+#   copy_and_fixup_bundle
+#   verify_app
 #   get_bundle_main_executable
 #   get_dotapp_dir
 #   get_bundle_and_executable
@@ -14,14 +15,108 @@
 #   get_bundle_keys
 #   copy_resolved_item_into_bundle
 #   fixup_bundle_item
-#   fixup_bundle
-#   copy_and_fixup_bundle
 #   verify_bundle_prerequisites
 #   verify_bundle_symlinks
-#   verify_app
 #
 # Requires CMake 2.6 or greater because it uses function, break and
 # PARENT_SCOPE. Also depends on GetPrerequisites.cmake.
+#
+#  FIXUP_BUNDLE(<app> <libs> <dirs>)
+# Fix up a bundle in-place and make it standalone, such that it can be
+# drag-n-drop copied to another machine and run on that machine as long as all
+# of the system libraries are compatible.
+#
+# Gather all the keys for all the executables and libraries in a bundle, and
+# then, for each key, copy each prerequisite into the bundle. Then fix each one
+# up according to its own list of prerequisites.
+#
+# Then clear all the keys and call verify_app on the final bundle to ensure
+# that it is truly standalone.
+#
+#  COPY_AND_FIXUP_BUNDLE(<src> <dst> <libs> <dirs>)
+# Makes a copy of the bundle <src> at location <dst> and then fixes up the
+# new copied bundle in-place at <dst>...
+#
+#  VERIFY_APP(<app>)
+# Verifies that an application <app> appears valid based on running analysis
+# tools on it. Calls "message(FATAL_ERROR" if the application is not verified.
+#
+#  GET_BUNDLE_MAIN_EXECUTABLE(<bundle> <result_var>)
+# The result will be the full path name of the bundle's main executable file
+# or an "error:" prefixed string if it could not be determined.
+#
+#  GET_DOTAPP_DIR(<exe> <dotapp_dir_var>)
+# Returns the nearest parent dir whose name ends with ".app" given the full
+# path to an executable. If there is no such parent dir, then return a dir at
+# the same level as the executable, named with the executable's base name and
+# ending with ".app"
+#
+# The returned directory may or may not exist.
+#
+#  GET_BUNDLE_AND_EXECUTABLE(<app> <bundle_var> <executable_var> <valid_var>)
+# Takes either a ".app" directory name or the name of an executable
+# nested inside a ".app" directory and returns the path to the ".app"
+# directory in <bundle_var> and the path to its main executable in
+# <executable_var>
+#
+#  GET_BUNDLE_ALL_EXECUTABLES(<bundle> <exes_var>)
+# Scans the given bundle recursively for all executable files and accumulates
+# them into a variable.
+#
+#  GET_ITEM_KEY(<item> <key_var>)
+# Given a file (item) name, generate a key that should be unique considering
+# the set of libraries that need copying or fixing up to make a bundle
+# standalone. This is essentially the file name including extension with "."
+# replaced by "_"
+#
+# This key is used as a prefix for CMake variables so that we can associate a
+# set of variables with a given item based on its key.
+#
+#  CLEAR_BUNDLE_KEYS(<keys_var>)
+# Loop over the list of keys, clearing all the variables associated with each
+# key. After the loop, clear the list of keys itself.
+#
+# Caller of get_bundle_keys should call clear_bundle_keys when done with list
+# of keys.
+#
+#  SET_BUNDLE_KEY_VALUES(<keys_var> <context> <item> <exepath> <dirs>
+#                        <copyflag>)
+# Add a key to the list (if necessary) for the given item. If added,
+# also set all the variables associated with that key.
+#
+#  GET_BUNDLE_KEYS(<app> <libs> <dirs> <keys_var>)
+# Loop over all the executable and library files within the bundle (and given
+# as extra <libs>) and accumulate a list of keys representing them. Set
+# values associated with each key such that we can loop over all of them and
+# copy prerequisite libs into the bundle and then do appropriate
+# install_name_tool fixups.
+#
+#  COPY_RESOLVED_ITEM_INTO_BUNDLE(<resolved_item> <resolved_embedded_item>)
+# Copy a resolved item into the bundle if necessary. Copy is not necessary if
+# the resolved_item is "the same as" the resolved_embedded_item.
+#
+#  FIXUP_BUNDLE_ITEM(<resolved_embedded_item> <exepath> <dirs>)
+# Get the direct/non-system prerequisites of the resolved embedded item. For
+# each prerequisite, change the way it is referenced to the value of the
+# _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely changing to
+# an "@executable_path" style reference.)
+#
+# Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM
+# value.
+#
+# Accumulate changes in a local variable and make *one* call to
+# install_name_tool at the end of the function with all the changes at once.
+#
+#  VERIFY_BUNDLE_PREREQUISITES(<bundle> <result_var> <info_var>)
+# Verifies that the sum of all prerequisites of all files inside the bundle
+# are contained within the bundle or are "system" libraries, presumed to exist
+# everywhere.
+#
+#  VERIFY_BUNDLE_SYMLINKS(<bundle> <result_var> <info_var>)
+# Verifies that any symlinks found in the bundle point to other files that are
+# already also in the bundle... Anything that points to an external file causes
+# this function to fail the verification.
+#
 
 #=============================================================================
 # Copyright 2008-2009 Kitware, Inc.
@@ -43,11 +138,6 @@ get_filename_component(BundleUtilities_cmake_dir "${CMAKE_CURRENT_LIST_FILE}" PA
 include("${BundleUtilities_cmake_dir}/GetPrerequisites.cmake")
 
 
-# get_bundle_main_executable
-#
-# The result will be the full path name of the bundle's main executable file
-# or an "error:" prefixed string if it could not be determined.
-#
 function(get_bundle_main_executable bundle result_var)
   set(result "error: '${bundle}/Contents/Info.plist' file does not exist")
 
@@ -109,15 +199,6 @@ function(get_bundle_main_executable bundle result_var)
 endfunction(get_bundle_main_executable)
 
 
-# get_dotapp_dir
-#
-# Returns the nearest parent dir whose name ends with ".app" given the full path
-# to an executable. If there is no such parent dir, then return a dir at the same
-# level as the executable, named with the executable's base name and ending with
-# ".app"
-#
-# The returned directory may or may not exist.
-#
 function(get_dotapp_dir exe dotapp_dir_var)
   set(s "${exe}")
 
@@ -155,13 +236,6 @@ function(get_dotapp_dir exe dotapp_dir_var)
 endfunction(get_dotapp_dir)
 
 
-# get_bundle_and_executable
-#
-# Takes either a ".app" directory name or the name of an executable
-# nested inside a ".app" directory and returns the path to the ".app"
-# directory in ${bundle_var} and the path to its main executable in
-# ${executable_var}
-#
 function(get_bundle_and_executable app bundle_var executable_var valid_var)
   set(valid 0)
 
@@ -215,11 +289,6 @@ function(get_bundle_and_executable app bundle_var executable_var valid_var)
 endfunction(get_bundle_and_executable)
 
 
-# get_bundle_all_executables
-#
-# Scans the given bundle recursively for all executable files and accumulates
-# them into a variable.
-#
 function(get_bundle_all_executables bundle exes_var)
   set(exes "")
 
@@ -235,15 +304,6 @@ function(get_bundle_all_executables bundle exes_var)
 endfunction(get_bundle_all_executables)
 
 
-# get_item_key
-#
-# Given a file (item) name, generate a key that should be unique considering the set of
-# libraries that need copying or fixing up to make a bundle standalone. This is
-# essentially the file name including extension with "." replaced by "_"
-#
-# This key is used as a prefix for CMake variables so that we can associate a set
-# of variables with a given item based on its key.
-#
 function(get_item_key item key_var)
   get_filename_component(item_name "${item}" NAME)
   if(WIN32)
@@ -254,14 +314,6 @@ function(get_item_key item key_var)
 endfunction(get_item_key)
 
 
-# clear_bundle_keys
-#
-# Loop over the list of keys, clearing all the variables associated with each
-# key. After the loop, clear the list of keys itself.
-#
-# Caller of get_bundle_keys should call clear_bundle_keys when done with list
-# of keys.
-#
 function(clear_bundle_keys keys_var)
   foreach(key ${${keys_var}})
     set(${key}_ITEM PARENT_SCOPE)
@@ -275,11 +327,6 @@ function(clear_bundle_keys keys_var)
 endfunction(clear_bundle_keys)
 
 
-# set_bundle_key_values
-#
-# Add a key to the list (if necessary) for the given item. If added,
-# also set all the variables associated with that key.
-#
 function(set_bundle_key_values keys_var context item exepath dirs copyflag)
   get_filename_component(item_name "${item}" NAME)
 
@@ -335,14 +382,6 @@ function(set_bundle_key_values keys_var context item exepath dirs copyflag)
 endfunction(set_bundle_key_values)
 
 
-# get_bundle_keys
-#
-# Loop over all the executable and library files within the bundle (and given as
-# extra "${libs}") and accumulate a list of keys representing them. Set values
-# associated with each key such that we can loop over all of them and copy
-# prerequisite libs into the bundle and then do appropriate install_name_tool
-# fixups.
-#
 function(get_bundle_keys app libs dirs keys_var)
   set(${keys_var} PARENT_SCOPE)
 
@@ -405,11 +444,6 @@ function(get_bundle_keys app libs dirs keys_var)
 endfunction(get_bundle_keys)
 
 
-# copy_resolved_item_into_bundle
-#
-# Copy a resolved item into the bundle if necessary. Copy is not necessary if
-# the resolved_item is "the same as" the resolved_embedded_item.
-#
 function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item)
   if(WIN32)
     # ignore case on Windows
@@ -433,18 +467,6 @@ function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item)
 endfunction(copy_resolved_item_into_bundle)
 
 
-# fixup_bundle_item
-#
-# Get the direct/non-system prerequisites of the resolved embedded item. For each
-# prerequisite, change the way it is referenced to the value of the _EMBEDDED_ITEM
-# keyed variable for that prerequisite. (Most likely changing to an "@executable_path"
-# style reference.)
-#
-# Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM value.
-#
-# Accumulate changes in a local variable and make *one* call to install_name_tool
-# at the end of the function with all the changes at once.
-#
 function(fixup_bundle_item resolved_embedded_item exepath dirs)
   # This item's key is "ikey":
   #
@@ -476,19 +498,6 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
 endfunction(fixup_bundle_item)
 
 
-# fixup_bundle
-#
-# Fix up a bundle in-place and make it standalone, such that it can be drag-n-drop
-# copied to another machine and run on that machine as long as all of the system
-# libraries are compatible.
-#
-# Gather all the keys for all the executables and libraries in a bundle, and then,
-# for each key, copy each prerequisite into the bundle. Then fix each one up according
-# to its own list of prerequisites.
-#
-# Then clear all the keys and call verify_app on the final bundle to ensure that
-# it is truly standalone.
-#
 function(fixup_bundle app libs dirs)
   message(STATUS "fixup_bundle")
   message(STATUS "  app='${app}'")
@@ -557,23 +566,12 @@ function(fixup_bundle app libs dirs)
 endfunction(fixup_bundle)
 
 
-# copy_and_fixup_bundle
-#
-# Makes a copy of the bundle "src" at location "dst" and then fixes up the
-# new copied bundle in-place at "dst"...
-#
 function(copy_and_fixup_bundle src dst libs dirs)
   execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${src}" "${dst}")
   fixup_bundle("${dst}" "${libs}" "${dirs}")
 endfunction(copy_and_fixup_bundle)
 
 
-# verify_bundle_prerequisites
-#
-# Verifies that the sum of all prerequisites of all files inside the bundle
-# are contained within the bundle or are "system" libraries, presumed to exist
-# everywhere.
-#
 function(verify_bundle_prerequisites bundle result_var info_var)
   set(result 1)
   set(info "")
@@ -635,12 +633,6 @@ function(verify_bundle_prerequisites bundle result_var info_var)
 endfunction(verify_bundle_prerequisites)
 
 
-# verify_bundle_symlinks
-#
-# Verifies that any symlinks found in the bundle point to other files that are
-# already also in the bundle... Anything that points to an external file causes
-# this function to fail the verification.
-#
 function(verify_bundle_symlinks bundle result_var info_var)
   set(result 1)
   set(info "")
@@ -654,11 +646,6 @@ function(verify_bundle_symlinks bundle result_var info_var)
 endfunction(verify_bundle_symlinks)
 
 
-# verify_app
-#
-# Verifies that an application appears valid based on running analysis tools on it.
-# Calls message/FATAL_ERROR if the application is not verified.
-#
 function(verify_app app)
   set(verified 0)
   set(info "")

-----------------------------------------------------------------------

Summary of changes:
 Modules/BundleUtilities.cmake     |  241 +++++++++++++++++--------------------
 Modules/GetPrerequisites.cmake    |  203 ++++++++++++++-----------------
 Source/kwsys/kwsysDateStamp.cmake |    2 +-
 3 files changed, 205 insertions(+), 241 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list