[asterisk-scf-commits] asterisk-scf/release/cmake.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Jan 17 13:42:39 CST 2011


branch "master" has been updated
       via  705c1a076b73351077992e4336109291f0ef5bb7 (commit)
      from  0e015db028ac1d9f72e9e8c54331a22a2bc99f38 (commit)

Summary of changes:
 AsteriskSCF.cmake |   36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit 705c1a076b73351077992e4336109291f0ef5bb7
Author: David M. Lee <dlee at digium.com>
Date:   Mon Jan 17 13:37:06 2011 -0600

    Changed add_slice to allow file lists and globbing.

diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index 06d201b..5f94b18 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -503,11 +503,43 @@ function(asterisk_scf_component_add_boost_libraries COMPONENT)
     link_directories(${Boost_LIBRARY_DIRS})
 endfunction()
 
-# Adds a slice file to a target.  This handles all the magic of creating the
+# Adds slice files to a target.  This handles all the magic of creating the
 # rules to run slice2cpp, adding the generated headers to the include path,
 # adding the generated .cpp file to the component, etc.  The generated files
 # are placed in ${CMAKE_CURRENT_BINARY_DIR}/generated.
-function(asterisk_scf_component_add_slice COMPONENT SLICE)
+#
+# The slice files are passed in as a list of globs, relative to
+# the current source directory.  The globs default to regular non-recursive
+# globs.  If you want to include subdirectories in you glob search, also
+# pass in GLOB_RECURSE.
+#
+# For example:
+#   asterisk_scf_component_add_slice(comp-name GLOB_RECURSE "*.ice")
+#
+# See http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:file for more
+# details on the globbing syntax.
+function(asterisk_scf_component_add_slice COMPONENT)
+    # default to glob syntax by default.  not as useful as GLOB_RECURSE, but
+    # follows the principle of least surprise
+    set(glob_style GLOB)
+    foreach(slice_glob ${ARGN})
+        if(${slice_glob} STREQUAL GLOB OR ${slice_glob} STREQUAL GLOB_RECURSE)
+            # change our globbing style
+            set(glob_style ${slice_glob})
+        else()
+            # expand the glob into a list of files
+            file(${glob_style} slices RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+                ${slice_glob})
+
+            foreach(slice ${slices})
+                asterisk_scf_component_add_one_slice(${COMPONENT} ${slice})
+            endforeach()
+        endif()
+    endforeach()
+    set(${COMPONENT}_SOURCES ${${COMPONENT}_SOURCES} PARENT_SCOPE)
+endfunction()
+
+function(asterisk_scf_component_add_one_slice COMPONENT SLICE)
     if(NOT SLICE_COMPILER)
         # Find the actual Slice compiler
         find_program(SLICE_COMPILER slice2cpp PATHS "${ICE_DIR}/bin"

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


-- 
asterisk-scf/release/cmake.git



More information about the asterisk-scf-commits mailing list