[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 10:53:20 CST 2011


branch "master" has been updated
       via  0e015db028ac1d9f72e9e8c54331a22a2bc99f38 (commit)
       via  787eba376cf49b90159955863421080929f9f903 (commit)
      from  419edd281ed4e2cf7fec527d6950edc1d7d512fa (commit)

Summary of changes:
 AsteriskSCF.cmake      | 1152 +++++++++++++++++++++---------------------------
 example/CMakeLists.txt |   21 +-
 2 files changed, 497 insertions(+), 676 deletions(-)


- Log -----------------------------------------------------------------
commit 0e015db028ac1d9f72e9e8c54331a22a2bc99f38
Author: David M. Lee <dlee at digium.com>
Date:   Wed Jan 12 13:34:38 2011 -0600

    Changed add_slice to be more consistent with add_file.
    
    asterisk_scf_component_add_slice will now add that slice file as a
    source for the named component, adding whatever rules are necessary for
    proper translation.

diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index c05b57f..06d201b 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -55,6 +55,8 @@ if(NOT integrated_build)
     message(FATAL_ERROR "This project can not be built in a non-integrated fashion. Please use the gitall script present in the gitall repository.")
 endif()
 
+message(STATUS "Installation prefix set to ${CMAKE_INSTALL_PREFIX}")
+
 # installation directories (these are all relative to ${CMAKE_INSTALL_PREFIX})
 set(INSTALL_SYS_CONF_DIR etc CACHE FILEPATH
     "read-only data files that pertain to a single machine")
@@ -424,12 +426,6 @@ function(asterisk_scf_slice_include_directories)
     set(SLICE_INCLUDE_DIRECTORIES ${paths} PARENT_SCOPE)
 endfunction()
 
-# Function which remembers definitions needed for a particular Slice target
-function(asterisk_scf_slice_compile_definitions SLICE_FILE)
-    get_filename_component(SLICE ${SLICE_FILE} NAME_WE)
-    set(SLICE_COMPILE_DEFINITIONS_${SLICE} ${ARGN} PARENT_SCOPE)
-endfunction()
-
 # Function which remembers Ice libraries needed by a Slice target
 function(asterisk_scf_slice_add_ice_libraries TARGET)
     if(NOT ARGN)
@@ -455,287 +451,12 @@ function(asterisk_scf_slice_add_dependencies TARGET)
     endforeach()
 endfunction()
 
-# Function which compiles one or more Slice definition files
-#
-# Syntax:
-# asterisk_scf_compile_slice(<target> [SOURCES source1 ... sourceN])
-#
-# Notes:
-# If only a target name is provided, it must include the '.ice'
-# extension; the target name will be the filename with the extension
-# removed.
-#
-# If SOURCES are provided, the function produces targets named
-# using the provided target name, but builds them from the listed
-# source files. The '.ice' extension must be included. Source file
-# names can be glob patterns.
-#
-# sets these variables (where SLICE is the target name computed):
-#
-# ASTERISK_SCF_SLICE_${SLICE}
-#  marker indicating this Slice has been built
-# ASTERISK_SCF_SLICE_${SLICE}_INCLUDE_DIRS
-#  directories where generated header files needed for this target live
-function(asterisk_scf_compile_slice TARGET_IN DIR_IN DESC_IN GROUP_IN)
-    if(ARGN)
-        foreach(arg ${ARGN})
-            if(NOT source_mode)
-	        if(arg STREQUAL "SOURCES")
-	            set(source_mode true)
-	        else()
-	            message(FATAL_ERROR "Unsupported argument '${arg}' passed to asterisk_scf_compile_slice")
-	        endif()
-            else()
-	        list(APPEND inputs "${arg}")
-            endif()
-        endforeach()
-        set(TARGET "${TARGET_IN}")
-    else()
-        set(slice_files "${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_IN}")
-        get_filename_component(file "${TARGET_IN}" NAME_WE)
-        set(TARGET "${file}")
-    endif()
-
-    # Now that we have the list of inputs, convert any of them
-    # that are glob-patterns into the list of files that match
-    if(source_mode)
-        foreach(input ${inputs})
-            if(IS_ABSOLUTE "${input}")
-	        file(GLOB globbed "${input}")
-            else()
-	        file(GLOB globbed "${CMAKE_CURRENT_SOURCE_DIR}/${input}")
-            endif()
-            if(globbed)
-	        foreach (glob ${globbed})
-	            file(TO_CMAKE_PATH "${glob}" cmake_path)
-	            if(glob MATCHES "\\.ice$")
-	                list(APPEND slice_files "${cmake_path}")
-	            endif()
-	            if(glob MATCHES "\\.h$")
-	                list(APPEND cpp_header_files "${cmake_path}")
-	            endif()
-	            if(glob MATCHES "\\.cpp$")
-	                list(APPEND cpp_source_files "${cmake_path}")
-	            endif()
-	        endforeach()
-            else()
-	        if(input MATCHES "\\.ice$")
-	            list(APPEND slice_files "${input}")
-	        endif()
-            endif()
-        endforeach()
-    endif()
-
-    # This makes the Slice definitions display in their own folder in the IDE,
-    # specifically Visual Studio
-    source_group("Slice Definitions" REGULAR_EXPRESSION "\\.ice$")
-
-    # Append the needed include directories for Slice definitions
-    # (global and the ones stored for this target)
-    if(ICE_SLICE_DIR)
-        list(APPEND slice_compiler_arguments "-I${ICE_SLICE_DIR}")
-    endif()
-    foreach(include ${SLICE_INCLUDE_DIRECTORIES})
-        # Each directory in this list will be in the source tree,
-        # which is what the Slice compiler will need
-        list(APPEND slice_compiler_arguments "-I${include}")
-        # If there are any CXX targets that depend on this target,
-        # they'll need a path to the *parallel* directory in the build
-        # tree where the Slice compiler will have generated the
-        # header file(s) for the Slice definitions in the source tree
-        # but only if the Slice include path is actually part of the
-        # source tree... if it's not, it is assumed that the relevant
-        # header files live in the same directory as the Slice files
-        file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${include}")
-        if(relpath MATCHES "^../")
-            # The directory is not located in the source tree, so use the
-            # original path
-            list(APPEND target_includes "${include}")
-        else()
-            # The directory is located in the source tree, so use the
-            # parallel path in the build tree
-            list(APPEND target_includes "${CMAKE_BINARY_DIR}/${relpath}")
-        endif()
-    endforeach()
-
-    # Append any definitions stored for this target
-    foreach(SLICEDEF ${SLICE_COMPILE_DEFINITIONS_${TARGET}})
-        list(APPEND slice_compiler_arguments "-D${SLICEDEF}")
-    endforeach()
-    list(REMOVE_DUPLICATES slice_compiler_arguments)
-
-    foreach(file ${slice_files})
-        file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${file}")
-        string(REPLACE "/" "_" file_variable ${relpath})
-        set_cache_var(TARGET_${file_variable} ${TARGET})
-    endforeach()
-
-    message(STATUS "Building Slice target ${TARGET} as a library")
-    set(suffixes cpp h)
-    include_directories("${CMAKE_CURRENT_BINARY_DIR}")
-
-    if(NOT SLICE_COMPILER)
-        # Find the actual Slice compiler
-        find_program(SLICE_COMPILER slice2cpp PATHS "${ICE_DIR}/bin" NO_DEFAULT_PATH)
-
-        # If we fail to find it we have to abort here, we can go no further
-        if(SLICE_COMPILER)
-            message(STATUS "Found Slice compiler at ${SLICE_COMPILER}")
-        else()
-            message(FATAL_ERROR "Failed to find Slice compiler")
-        endif()
-    endif()
-
-    # Look for the dependencies for this slice definition, we have to do it now since the target was just added
-    message(STATUS "Determining dependencies for Slice target ${TARGET}")
-    execute_process(COMMAND ${SLICE_COMPILER} ${slice_compiler_arguments}
-        --depend ${slice_files} OUTPUT_VARIABLE raw_dependencies
-        ERROR_VARIABLE slice_errors)
-    if(slice_errors)
-        message(FATAL_ERROR "Slice compiler produced errors:\n ${slice_errors}")
-    endif()
-
-    if(raw_dependencies)
-        # The next block of stuff sanitizes the output we got from the slice compiler into a non-Makefile specific foo
-        # Get rid of all the \ characters
-        string(REPLACE "\\" "" raw_dependencies "${raw_dependencies}")
-        # Turn the newlines into CMake list item separators, since the compiler spits out one dependency per line
-        string(REPLACE "\n" ";" raw_dependencies "${raw_dependencies}")
-        string(REPLACE " ;" ";" raw_dependencies "${raw_dependencies}")
-        string(REPLACE "; " ";" raw_dependencies "${raw_dependencies}")
-
-        foreach(dep ${raw_dependencies})
-            # If the name ends with a colon, it's actually a Makefile target name and should be
-            # skipped
-            if(NOT dep MATCHES ":$")
-                # Convert the path into a cmake one so we can absolutely get the filename
-	        file(TO_CMAKE_PATH ${dep} dep)
-	        file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${dep}")
-	        string(REPLACE "/" "_" file_variable "${relpath}")
-	        set(dep_target ${TARGET_${file_variable}})
-	        if(dep_target)
-	            # If this is not already us add it as a dependency
-	            if(NOT dep_target STREQUAL ${TARGET})
-	                message(STATUS "Auto-adding dependency on Slice target ${dep_target} to ${TARGET}")
-	                list(APPEND source_dependencies ${dep})
-	                list(APPEND target_dependencies ${dep_target})
-	                list(APPEND target_includes ${ASTERISK_SCF_SLICE_${dep_target}_INCLUDE_DIRS})
-	            endif()
-	        else()
-	            # Remember sources that are not associated with targets too
-	            message(STATUS "Auto-adding dependency on Slice source ${dep} to ${TARGET}")
-	            list(APPEND source_dependencies ${dep})
-	        endif()
-            endif()
-        endforeach()
-    endif()
-
-    foreach(file ${slice_files})
-        foreach(suffix ${suffixes})
-            get_filename_component(source "${file}" NAME_WE)
-            list(APPEND generated_files "${CMAKE_CURRENT_BINARY_DIR}/${source}.${suffix}")
-        endforeach()
-    endforeach()
-
-    set_source_files_properties(${generated_files} PROPERTIES GENERATED 1)
-
-    # create a preprocessor definition in the generated CXX files that enables
-    # the generated classes to be exported from the library (only necessary on Windows)
-    # the definition for a target named 'FOO' will be 'FOO_EXPORTS', and if this
-    # preprocessor macro is defined, then the Slice-generated classes will be marked
-    # with 'dllexport'. add_library() (used below) automatically generates a definition
-    # for the appropriately-named macro when the library is built in SHARED mode.
-    if(WIN32)
-        list(APPEND slice_export_arguments "--dll-export" "${TARGET}")
-    endif()
-
-    add_custom_command(
-        OUTPUT ${generated_files}
-        COMMAND ${SLICE_COMPILER} ${slice_compiler_arguments} ${slice_export_arguments} ${slice_files}
-        COMMENT "Building ${TARGET} from ${slice_files} using slice2cpp"
-        DEPENDS ${slice_files} ${source_dependencies}
-        )
-
-    if(target_includes)
-        list(REMOVE_DUPLICATES target_includes)
-    endif()
-
-    # Note that slice_files are included as sources here even though they won't be compiled
-    # by the actual compiler; this is to get them to show up as sources in the project
-    # created for this target
-    include_directories(${target_includes})
-    # If there are any non-generated header files required for this Slice target, copy
-    # them to the binary directory where they will be needed later. The destination
-    # path to file() defaults to the binary directory, so there is no need to
-    # re-specify it here.
-    if(cpp_header_files)
-        file(COPY ${cpp_header_files} DESTINATION .)
-    endif()
-    add_library(${TARGET} ${generated_files} ${slice_files} ${cpp_source_files})
-    install(TARGETS ${TARGET} DESTINATION ${DIR_IN} COMPONENT ${TARGET})
-    if(ASTERISKSCF_CPACK)
-        # Adds a component to the packager. The first arg must have been previously defined
-        # as a COMPONENT arg to install.
-        cpack_add_component(${TARGET} DESCRIPTION ${DESC_IN} GROUP ${GROUP_IN})
-    endif()
-    foreach(lib ${${TARGET}_ICE_LIBRARIES} ${ASTERISK_SCF_ICE_LIBRARIES})
-        if(UNIX)
-            list(APPEND target_libs "${lib}")
-        else()
-            list(APPEND target_libs "${ICE_LIB_${lib}}")
-        endif()
-    endforeach()
-    if(target_libs)
-        target_link_libraries(${TARGET} ${target_libs})
-    endif()
-    if(APPLE)
-        target_link_libraries(${TARGET} ${ICE_LIB_IceUtil})
-        target_link_libraries(${TARGET} ${ICE_LIB_ZeroCIce})
-    endif()
-    if(target_dependencies)
-        message(STATUS "Linking ${TARGET} to ${target_dependencies}")
-        target_link_libraries(${TARGET} ${target_dependencies})
-        add_dependencies(${TARGET} ${target_dependencies})
-    endif()
-    if(UNIX)
-        set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS "-fPIC")
-    endif()
-    set_cache_var(ASTERISK_SCF_SLICE_${TARGET}_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${target_includes})
-    set_cache_var(ASTERISK_SCF_SLICE_${TARGET} Bob)
-endfunction()
-
 # Function which initializes a component for building
 function(asterisk_scf_component_init COMPONENT)
     message(STATUS "Setting up to build component ${COMPONENT}")
     set(ASTERISK_SCF_${COMPONENT} Bob PARENT_SCOPE)
 endfunction()
 
-# Function which adds the compiled Slice targets to a component to be built
-function(asterisk_scf_component_add_slice COMPONENT)
-    if(NOT ARGN)
-        message(FATAL_ERROR "You must pass at least one Slice target to this function")
-    endif()
-    if(NOT ASTERISK_SCF_${COMPONENT})
-        message(FATAL_ERROR "Must call asterisk_scf_component_init for component ${COMPONENT} before asterisk_scf_component_add_slice")
-    endif()
-    set(slice_list ${${COMPONENT}_SLICES})
-    foreach(slice ${ARGN})
-        get_filename_component(f ${slice} NAME_WE)
-        if(NOT ASTERISK_SCF_SLICE_${f})
-            message(FATAL_ERROR "Must call asterisk_scf_compile_slice for ${f} before asterisk_scf_component_add_slice")
-        endif()
-        message(STATUS "Adding Slice ${f} to component ${COMPONENT}")
-        list(APPEND slice_list ${f})
-        list(APPEND include_dirs ${ASTERISK_SCF_SLICE_${slice}_INCLUDE_DIRS})
-    endforeach()
-    list(REMOVE_DUPLICATES slice_list)
-    set(${COMPONENT}_SLICES ${slice_list} PARENT_SCOPE)
-    if(include_dirs)
-        list(REMOVE_DUPLICATES include_dirs)
-        include_directories(${include_dirs})
-    endif()
-endfunction()
-
 # Function which adds source or header files to a component to be built
 function(asterisk_scf_component_add_file COMPONENT)
     if(NOT ARGN)
@@ -782,6 +503,123 @@ 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
+# 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)
+    if(NOT SLICE_COMPILER)
+        # Find the actual Slice compiler
+        find_program(SLICE_COMPILER slice2cpp PATHS "${ICE_DIR}/bin"
+            NO_DEFAULT_PATH)
+
+        # If we fail to find it we have to abort here, we can go no further
+        if(SLICE_COMPILER)
+            message(STATUS "Found Slice compiler at ${SLICE_COMPILER}")
+        else()
+            message(FATAL_ERROR "Failed to find Slice compiler")
+        endif()
+    endif()
+
+    # This makes the Slice definitions display in their own folder in the IDE,
+    # specifically Visual Studio
+    source_group("Slice Definitions" REGULAR_EXPRESSION "\\.ice$")
+
+    # Append the needed include directories for Slice definitions
+    # (global and the ones stored for this target)
+    if(ICE_SLICE_DIR)
+        list(APPEND slice_compiler_arguments "-I${ICE_SLICE_DIR}")
+    endif()
+    foreach(include ${SLICE_INCLUDE_DIRECTORIES})
+        # Each directory in this list will be in the source tree,
+        # which is what the Slice compiler will need
+        list(APPEND slice_compiler_arguments "-I${include}")
+    endforeach()
+
+    message(STATUS "Adding ${SLICE} to ${COMPONENT}")
+    # get subdirectory slice is in
+    get_filename_component(slice_subdir "${SLICE}" PATH)
+
+    # get the directory in which to put the generated code
+    set(slice_out_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
+    # if the slice file is in a subdirectory, maintain that structure
+    if(slice_subdir AND NOT ${slice_subdir} MATCHES "\\.\\.")
+        set(slice_out_dir "${slice_out_dir}/${slice_subdir}")
+    endif()
+    get_filename_component(slice_basename "${SLICE}" NAME_WE)
+    # headers are generated, so add them to the include path
+    include_directories("${CMAKE_CURRENT_BINARY_DIR}/generated")
+    # generated .cpp files #include <.h> directly, which requires the out_dir
+    # itself to be in the include path
+    include_directories("${slice_out_dir}")
+
+    # fully specify SLICE's path
+    set(SLICE "${CMAKE_CURRENT_SOURCE_DIR}/${SLICE}")
+
+    # Look for the dependencies for this slice definition, we have to do it now
+    # since the target was just added
+    message(STATUS "Determining dependencies for ${slice_basename}")
+    execute_process(
+        COMMAND ${SLICE_COMPILER} ${slice_compiler_arguments} --depend ${SLICE}
+        OUTPUT_VARIABLE raw_dependencies
+        ERROR_VARIABLE slice_errors)
+    if(slice_errors)
+        message(FATAL_ERROR "Slice compiler produced errors:\n ${slice_errors}")
+    endif()
+
+    if(raw_dependencies)
+        # get rid of folded newlines
+        string(REPLACE "\\\n" "" raw_dependencies "${raw_dependencies}")
+        # turn newlines into item separators
+        string(REPLACE "\n" ";" raw_dependencies "${raw_dependencies}")
+
+        foreach(dep ${raw_dependencies})
+            # each dep is of the form:
+            #target1 target2 [...] target_n: source1 source2 [...] source_n
+
+            # parse targets
+            string(REGEX MATCHALL "^[^:]+" dep_targets "${dep}")
+            string(REGEX MATCHALL "[^ ]+" dep_targets "${dep_targets}")
+            list(APPEND targets ${dep_targets})
+
+            # parse sources
+            string(REGEX MATCHALL "[^:]+$" dep_sources "${dep}")
+            string(REGEX MATCHALL "[^ ]+" dep_sources "${dep_sources}")
+            list(APPEND sources ${dep_sources})
+        endforeach()
+    endif()
+
+    # prepend the slice_out_dir to the targets
+    foreach(target ${targets})
+        list(APPEND generated_files "${slice_out_dir}/${target}")
+    endforeach()
+    # you would think that would be enough, but slice2cpp doesn't generate a
+    # dep for the .h file
+    list(APPEND generated_files "${slice_out_dir}/${slice_basename}.h")
+    # and be resilient in case it does so in the future...
+    list(REMOVE_DUPLICATES generated_files)
+    set_source_files_properties(${generated_files} PROPERTIES GENERATED 1)
+
+    # create a preprocessor definition in the generated CXX files that enables
+    # the generated classes to be exported from the library (only necessary on
+    # Windows)
+    if(WIN32)
+        list(APPEND slice_compiler_arguments "--dll-export" "ASTERISK_SCF_ICEBOX_EXPORT")
+    endif()
+
+    file(MAKE_DIRECTORY ${slice_out_dir})
+    add_custom_command(
+        OUTPUT ${generated_files}
+        COMMAND ${SLICE_COMPILER} ${slice_compiler_arguments} ${SLICE}
+        --output-dir ${slice_out_dir}
+        COMMENT "slice2cpp translating ${SLICE}"
+        DEPENDS ${sources})
+
+    # now the generated_files are sources for the component
+    list(APPEND ${COMPONENT}_SOURCES ${generated_files})
+    set(${COMPONENT}_SOURCES ${${COMPONENT}_SOURCES} PARENT_SCOPE)
+endfunction()
+
 # Function which builds a component as an IceBox service
 function(asterisk_scf_component_build_icebox COMPONENT)
     message(STATUS "Building component ${COMPONENT} as an IceBox service")
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index 63feb16..5e09015 100644
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -51,9 +51,6 @@ asterisk_scf_component_init(examplebox)
 # its subdirectories
 asterisk_scf_slice_include_directories(/home/zaphod/slice)
 
-# If a Slice definition requires macro definitions, they can be specified with this function.
-asterisk_scf_slice_compile_definitions(fluxcapacitor SERVER JOSH=LEET2)
-
 # If a Slice definition uses any Ice-provided definitions (for example, IceBox or IceStorm), then for
 # some languages it is necessary to reference the Ice-provided libraries containing those definitions
 # when building the target. The names of the needed libraries can be provided using this function.
@@ -62,23 +59,9 @@ asterisk_scf_slice_compile_definitions(fluxcapacitor SERVER JOSH=LEET2)
 # TODO: still needed?
 asterisk_scf_slice_add_ice_libraries(fluxcapacitor IceStorm)
 
-# This function compiles a Slice definition (or more than one) into a library.
-# It produces a target named the same as the Slice file without the extension, which can be used in calls to
-# asterisk_scf_slice_include_directories(), asterisk_scf_slice_compile_definitions(),
-# asterisk_scf_component_add_slice(), and asterisk_scf_slice_add_ice_libraries().
-#  Parameters to asterisk_scf_compile_slice:
-#     - The target Slice definition filename. 
-#     - The subdirectory in which to install the output of the build. "lib" is good for most cases, but some 
-#       optional components may choose to install elsewhere. 
-#     - Description for use by the packager. This text typically appears when the user hovers over the component's name
-#       in the installer. 
-#     - Group for use by the packager. The group should be previously configured in the CPackConfig.cmake file. The user
-#       is typically allowed to select specific groups during a custom install process. 
-asterisk_scf_compile_slice(fluxcapacitor.ice lib "Slice Defined API" Core)
-
 # This function takes a component name and Slice target as parameters. It adds the Slice target
 # to the component so it is compiled in and so the headers are made available.
-asterisk_scf_component_add_slice(examplebox fluxcapacitor)
+asterisk_scf_component_add_slice(examplebox fluxcapacitor.ice)
 
 # This function takes a component name and source file as parameters. The source file is added in so it gets
 # compiled into the component. This *must* be called from the same directory that the source file exists in.
@@ -101,7 +84,7 @@ asterisk_scf_component_install(examplebox LIBRARY lib "Icebox example component.
 
 # Now we move on to the next component, a standalone executable.
 asterisk_scf_component_init(example)
-asterisk_scf_component_add_slice(example fluxcapacitor)
+asterisk_scf_component_add_slice(example fluxcapacitor.ice)
 asterisk_scf_component_add_file(example example.cpp)
 
 # This function takes a component name as the parameter. It builds a standalone executable.

commit 787eba376cf49b90159955863421080929f9f903
Author: David M. Lee <dlee at digium.com>
Date:   Tue Jan 11 15:30:10 2011 -0600

    Fixed indention to match style guide.

diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index c4831c5..c05b57f 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -47,12 +47,12 @@
 #
 
 if(CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
-  message(FATAL_ERROR "This project must not be built in the source directory")
+    message(FATAL_ERROR "This project must not be built in the source directory")
 endif()
 
 # Only permit integrated builds to be done at this time
 if(NOT integrated_build)
-  message(FATAL_ERROR "This project can not be built in a non-integrated fashion. Please use the gitall script present in the gitall repository.")
+    message(FATAL_ERROR "This project can not be built in a non-integrated fashion. Please use the gitall script present in the gitall repository.")
 endif()
 
 # installation directories (these are all relative to ${CMAKE_INSTALL_PREFIX})
@@ -108,28 +108,28 @@ mark_as_advanced(
 
 # Use a compile test to see if shared_ptr is supported. If present then C++0x support exists.
 if(CMAKE_COMPILER_IS_GNUCXX)
-  try_compile(SHARED_PTR_PRESENT
-    ${CMAKE_BINARY_DIR}
-    ${CMAKE_SOURCE_DIR}/cmake/tests/SharedPtr.cpp
-    COMPILE_DEFINITIONS "-std=c++0x"
-    OUTPUT_VARIABLE OUTPUT
-    )
-  if(SHARED_PTR_PRESENT)
-    message(STATUS "Support for C++0x Enabled")
-    add_definitions("-DCPP_ZEROX_SUPPORT")
-    set(CPP_ZEROX_STD "-std=c++0x")
-  else()
-    message(STATUS "Support for C++0x Disabled")
-  endif()
+    try_compile(SHARED_PTR_PRESENT
+        ${CMAKE_BINARY_DIR}
+        ${CMAKE_SOURCE_DIR}/cmake/tests/SharedPtr.cpp
+        COMPILE_DEFINITIONS "-std=c++0x"
+        OUTPUT_VARIABLE OUTPUT
+        )
+    if(SHARED_PTR_PRESENT)
+        message(STATUS "Support for C++0x Enabled")
+        add_definitions("-DCPP_ZEROX_SUPPORT")
+        set(CPP_ZEROX_STD "-std=c++0x")
+    else()
+        message(STATUS "Support for C++0x Disabled")
+    endif()
 endif()
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
 
 # If a build type has not been explicitly specified then use debug
 if(NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE debug CACHE STRING
-    "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Profile."
-    FORCE)
+    set(CMAKE_BUILD_TYPE debug CACHE STRING
+        "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Profile."
+        FORCE)
 endif()
 
 # since Debug, debug and DeBuG all mean the same thing to cmake, tolower it
@@ -140,66 +140,66 @@ string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
 find_package(Threads REQUIRED)
 
 if(CMAKE_SYSTEM MATCHES "SunOS.*")
-  set(CMAKE_CXX_FLAGS "-pthreads ")
+    set(CMAKE_CXX_FLAGS "-pthreads ")
 endif()
 
 if(CMAKE_COMPILER_IS_GNUC)
-  set(CMAKE_C_FLAGS_DEBUG "-Werror -Wall -g3"
-    CACHE STRING "Flags used by the compiler during debug builds." FORCE)
+    set(CMAKE_C_FLAGS_DEBUG "-Werror -Wall -g3"
+        CACHE STRING "Flags used by the compiler during debug builds." FORCE)
 endif()
 if(CMAKE_COMPILER_IS_GNUCXX)
-  set(CMAKE_CXX_FLAGS "${CPP_ZEROX_STD}"
-    CACHE STRING "Flags used by the compiler during release builds." FORCE)
-  set(CMAKE_CXX_FLAGS_DEBUG "-Werror -Wall -g3"
-    CACHE STRING "Flags used by the compiler during debug builds." FORCE)
+    set(CMAKE_CXX_FLAGS "${CPP_ZEROX_STD}"
+        CACHE STRING "Flags used by the compiler during release builds." FORCE)
+    set(CMAKE_CXX_FLAGS_DEBUG "-Werror -Wall -g3"
+        CACHE STRING "Flags used by the compiler during debug builds." FORCE)
 endif()
 
 if(WIN32 AND ${CMAKE_BUILD_TYPE} STREQUAL profile)
-  message(FATAL_ERROR "Profile builds not supported")
+    message(FATAL_ERROR "Profile builds not supported")
 endif()
 
 if(NOT WIN32)
-  message(STATUS "Adding profile flags")
-  set(CMAKE_C_FLAGS_PROFILE
-    "${CMAKE_C_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs"
-    CACHE STRING "Flags used by the compiler during profile builds." FORCE)
-  set(CMAKE_CXX_FLAGS_PROFILE
-    "${CMAKE_CXX_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs"
-    CACHE STRING "Flags used by the compiler during profile builds." FORCE)
-  set(CMAKE_EXE_LINKER_FLAGS_PROFILE
-    "${CMAKE_EXE_LINKER_FLAGS_DEBUG}"
-    CACHE STRING "Flags used by the linker during profile builds." FORCE)
-
-  mark_as_advanced(
-    CMAKE_C_FLAGS_PROFILE
-    CMAKE_CXX_FLAGS_PROFILE
-    CMAKE_EXE_LINKER_FLAGS_PROFILE)
+    message(STATUS "Adding profile flags")
+    set(CMAKE_C_FLAGS_PROFILE
+        "${CMAKE_C_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs"
+        CACHE STRING "Flags used by the compiler during profile builds." FORCE)
+    set(CMAKE_CXX_FLAGS_PROFILE
+        "${CMAKE_CXX_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs"
+        CACHE STRING "Flags used by the compiler during profile builds." FORCE)
+    set(CMAKE_EXE_LINKER_FLAGS_PROFILE
+        "${CMAKE_EXE_LINKER_FLAGS_DEBUG}"
+        CACHE STRING "Flags used by the linker during profile builds." FORCE)
+
+    mark_as_advanced(
+        CMAKE_C_FLAGS_PROFILE
+        CMAKE_CXX_FLAGS_PROFILE
+        CMAKE_EXE_LINKER_FLAGS_PROFILE)
 endif()
 
 if(${CMAKE_BUILD_TYPE} STREQUAL profile)
-  message(STATUS "Disabling shared libs.")
-  set(BUILD_SHARED_LIBS false
-    CACHE BOOL "Enables building shared libraries." FORCE)
+    message(STATUS "Disabling shared libs.")
+    set(BUILD_SHARED_LIBS false
+        CACHE BOOL "Enables building shared libraries." FORCE)
 endif()
 
 if(NOT DEFINED BUILD_SHARED_LIBS)
-  message(STATUS "Enabling shared libs.")
-  set(BUILD_SHARED_LIBS true
-    CACHE BOOL "Enables building shared libraries." FORCE)
+    message(STATUS "Enabling shared libs.")
+    set(BUILD_SHARED_LIBS true
+        CACHE BOOL "Enables building shared libraries." FORCE)
 endif()
 
 # Enable the use of CTest for running unit tests
 enable_testing()
 
 if(UNIX AND EXISTS "${CMAKE_SOURCE_DIR}/.svn")
-  add_custom_target(update COMMAND svn update WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating checkout")
+    add_custom_target(update COMMAND svn update WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating checkout")
 elseif(UNIX AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
-  add_custom_target(update COMMAND git pull WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating clone")
-  add_custom_target(pull COMMAND git pull WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating clone")
+    add_custom_target(update COMMAND git pull WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating clone")
+    add_custom_target(pull COMMAND git pull WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Updating clone")
 endif()
 
 macro(set_cache_var)
-  set(${ARGV} CACHE INTERNAL Bob FORCE)
+    set(${ARGV} CACHE INTERNAL Bob FORCE)
 endmacro()
 
 # Function which scans a path for matching files or directories,
@@ -208,251 +208,251 @@ endmacro()
 # if there were no matches. Single-character globs (?) can
 # be used in the base string, but not multi-character globs (*).
 function(find_best_version output base)
-  get_filename_component(base_full "${base}" ABSOLUTE)
-  file(GLOB path_list "${base_full}*")
-  string(LENGTH "${base_full}" base_length)
-  foreach(path ${path_list})
-    get_filename_component(path_full "${path}" ABSOLUTE)
-    string(LENGTH "${path_full}" path_length)
-    math(EXPR get "${path_length} - ${base_length}")
-    string(SUBSTRING "${path_full}" ${base_length} ${get} ver)
-    if(NOT DEFINED best_ver)
-      set(best_ver ${ver})
-      set(best_path "${path_full}")
-    elseif(best_ver VERSION_LESS ver)
-      set(best_ver ${ver})
-      set(best_path "${path_full}")
-    endif()
-  endforeach()
-  if(DEFINED best_ver)
-    set(${output} "${best_path}" PARENT_SCOPE)
-  else()
-    set(${output} "NOTFOUND" PARENT_SCOPE)
-  endif()
+    get_filename_component(base_full "${base}" ABSOLUTE)
+    file(GLOB path_list "${base_full}*")
+    string(LENGTH "${base_full}" base_length)
+    foreach(path ${path_list})
+        get_filename_component(path_full "${path}" ABSOLUTE)
+        string(LENGTH "${path_full}" path_length)
+        math(EXPR get "${path_length} - ${base_length}")
+        string(SUBSTRING "${path_full}" ${base_length} ${get} ver)
+        if(NOT DEFINED best_ver)
+            set(best_ver ${ver})
+            set(best_path "${path_full}")
+        elseif(best_ver VERSION_LESS ver)
+            set(best_ver ${ver})
+            set(best_path "${path_full}")
+        endif()
+    endforeach()
+    if(DEFINED best_ver)
+        set(${output} "${best_path}" PARENT_SCOPE)
+    else()
+        set(${output} "NOTFOUND" PARENT_SCOPE)
+    endif()
 endfunction()
 
 # Find Ice installation for a specific major/minor version
 function(find_ICE version)
-  set(ice "$ENV{ICE_HOME}")
-  if(NOT ice)
-    if(WIN32)
-      find_best_version(ice "C:/Ice-${version}")
-    elseif(UNIX)
-      find_best_version(ice "/opt/Ice-${version}")
-    endif()
-  endif()
-
-  if(NOT ice)
-    message(FATAL_ERROR "Could not find an installation of Ice with version ${version}")
-  endif()
-  find_path(ICE_SLICE_DIR Ice/Current.ice PATHS "${ice}/../slice" "${ice}/slice" NO_DEFAULT_PATH)
-  if(ICE_SLICE_DIR)
-    message(STATUS "Found Ice Slice definitions in ${ICE_SLICE_DIR}")
-  else()
-    message(FATAL_ERROR "Ice installation located at ${ice} is incomplete or broken (missing 'slice' directory)")
-  endif()
-  file(TO_CMAKE_PATH "${ice}" ice_cmake_path)
-  set_cache_var(ICE_DIR "${ice_cmake_path}")
-
-  # find icebox executable
-  # XXX Need to look for iceboxd.exe for debug windows builds
-  find_program(ICEBOX icebox PATHS "${ICE_DIR}/bin" NO_DEFAULT_PATH)
-
-  if(ICEBOX)
-    message(STATUS "Found icebox at ${ICEBOX}")
-  else()
-    message(WARNING "Failed to find icebox ${ICE_DIR}")
-  endif()
-  find_path(ICE_INCLUDE_DIR Ice/Ice.h PATHS "${ICE_DIR}/include" NO_DEFAULT_PATH)
-  if(ICE_INCLUDE_DIR)
-    message(STATUS "Found Ice headers in ${ICE_INCLUDE_DIR}")
-  else()
-    message(FATAL_ERROR "Failed to find Ice headers")
-  endif()
-  # This block essentially tricks the GNU compiler into treating the Ice header files as system headers. This has
-  # the benefit of having warnings emitted by the headers NOT treated as errors, even if the compiler has been told
-  # to do so. This is currently being utilized by the C++0x support in this file so that Ice itself does not have to
-  # be updated to be C++0x safe.
-  if(CMAKE_COMPILER_IS_GNUCXX)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${ICE_INCLUDE_DIR}"
-      CACHE STRING "Flags used by the compiler during release builds." FORCE)
-  endif()
+    set(ice "$ENV{ICE_HOME}")
+    if(NOT ice)
+        if(WIN32)
+            find_best_version(ice "C:/Ice-${version}")
+        elseif(UNIX)
+            find_best_version(ice "/opt/Ice-${version}")
+        endif()
+    endif()
+
+    if(NOT ice)
+        message(FATAL_ERROR "Could not find an installation of Ice with version ${version}")
+    endif()
+    find_path(ICE_SLICE_DIR Ice/Current.ice PATHS "${ice}/../slice" "${ice}/slice" NO_DEFAULT_PATH)
+    if(ICE_SLICE_DIR)
+        message(STATUS "Found Ice Slice definitions in ${ICE_SLICE_DIR}")
+    else()
+        message(FATAL_ERROR "Ice installation located at ${ice} is incomplete or broken (missing 'slice' directory)")
+    endif()
+    file(TO_CMAKE_PATH "${ice}" ice_cmake_path)
+    set_cache_var(ICE_DIR "${ice_cmake_path}")
+
+    # find icebox executable
+    # XXX Need to look for iceboxd.exe for debug windows builds
+    find_program(ICEBOX icebox PATHS "${ICE_DIR}/bin" NO_DEFAULT_PATH)
+
+    if(ICEBOX)
+        message(STATUS "Found icebox at ${ICEBOX}")
+    else()
+        message(WARNING "Failed to find icebox ${ICE_DIR}")
+    endif()
+    find_path(ICE_INCLUDE_DIR Ice/Ice.h PATHS "${ICE_DIR}/include" NO_DEFAULT_PATH)
+    if(ICE_INCLUDE_DIR)
+        message(STATUS "Found Ice headers in ${ICE_INCLUDE_DIR}")
+    else()
+        message(FATAL_ERROR "Failed to find Ice headers")
+    endif()
+    # This block essentially tricks the GNU compiler into treating the Ice header files as system headers. This has
+    # the benefit of having warnings emitted by the headers NOT treated as errors, even if the compiler has been told
+    # to do so. This is currently being utilized by the C++0x support in this file so that Ice itself does not have to
+    # be updated to be C++0x safe.
+    if(CMAKE_COMPILER_IS_GNUCXX)
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${ICE_INCLUDE_DIR}"
+            CACHE STRING "Flags used by the compiler during release builds." FORCE)
+    endif()
 endfunction()
 
 # Find an Ice library.
 function(find_ICE_library LIBRARY)
-  if(NOT ICE_LIB_${LIBRARY})
-    if(WIN32)
-      string(TOLOWER ${LIBRARY} lib)
-      find_library(ICE_LIB_RELEASE_${LIBRARY} ${lib} PATHS "${ICE_DIR}/lib" NO_DEFAULT_PATH)
-      if(ICE_LIB_RELEASE_${LIBRARY})
-	message(STATUS "Found Ice '${LIBRARY}' library (release build) at ${ICE_LIB_RELEASE_${LIBRARY}}")
-	list(APPEND ficxxl_libs optimized "${ICE_LIB_RELEASE_${LIBRARY}}")
-      endif()
-      find_library(ICE_LIB_DEBUG_${LIBRARY} ${lib}d PATHS "${ICE_DIR}/lib" NO_DEFAULT_PATH)
-      if(ICE_LIB_DEBUG_${LIBRARY})
-	message(STATUS "Found Ice '${LIBRARY}' library (debug build) at ${ICE_LIB_DEBUG_${LIBRARY}}")
-	list(APPEND ficxxl_libs debug "${ICE_LIB_DEBUG_${LIBRARY}}")
-      endif()
-      if(ficxxl_libs)
-	set_cache_var(ICE_LIB_${LIBRARY} ${ficxxl_libs})
-      else()
-	message(FATAL_ERROR "Failed to find Ice '${LIBRARY}' library")
-      endif()
-    elseif(UNIX)
-      find_library(ICE_LIB_${LIBRARY} ${LIBRARY} PATHS "${ICE_DIR}/lib" "${ICE_DIR}/lib32" "${ICE_DIR}/lib64" NO_DEFAULT_PATH)
-      if(ICE_LIB_${LIBRARY})
-	message(STATUS "Found Ice '${LIBRARY}' library at ${ICE_LIB_${LIBRARY}}")
-      else()
-	message(FATAL_ERROR "Failed to find Ice '${LIBRARY}' library")
-      endif()
-    endif()
-  endif()
-
-  if(UNIX)
-    get_filename_component(library_path ${ICE_LIB_${LIBRARY}} PATH)
-    link_directories(${library_path})
-  endif()
+    if(NOT ICE_LIB_${LIBRARY})
+        if(WIN32)
+            string(TOLOWER ${LIBRARY} lib)
+            find_library(ICE_LIB_RELEASE_${LIBRARY} ${lib} PATHS "${ICE_DIR}/lib" NO_DEFAULT_PATH)
+            if(ICE_LIB_RELEASE_${LIBRARY})
+	        message(STATUS "Found Ice '${LIBRARY}' library (release build) at ${ICE_LIB_RELEASE_${LIBRARY}}")
+	        list(APPEND ficxxl_libs optimized "${ICE_LIB_RELEASE_${LIBRARY}}")
+            endif()
+            find_library(ICE_LIB_DEBUG_${LIBRARY} ${lib}d PATHS "${ICE_DIR}/lib" NO_DEFAULT_PATH)
+            if(ICE_LIB_DEBUG_${LIBRARY})
+	        message(STATUS "Found Ice '${LIBRARY}' library (debug build) at ${ICE_LIB_DEBUG_${LIBRARY}}")
+	        list(APPEND ficxxl_libs debug "${ICE_LIB_DEBUG_${LIBRARY}}")
+            endif()
+            if(ficxxl_libs)
+	        set_cache_var(ICE_LIB_${LIBRARY} ${ficxxl_libs})
+            else()
+	        message(FATAL_ERROR "Failed to find Ice '${LIBRARY}' library")
+            endif()
+        elseif(UNIX)
+            find_library(ICE_LIB_${LIBRARY} ${LIBRARY} PATHS "${ICE_DIR}/lib" "${ICE_DIR}/lib32" "${ICE_DIR}/lib64" NO_DEFAULT_PATH)
+            if(ICE_LIB_${LIBRARY})
+	        message(STATUS "Found Ice '${LIBRARY}' library at ${ICE_LIB_${LIBRARY}}")
+            else()
+	        message(FATAL_ERROR "Failed to find Ice '${LIBRARY}' library")
+            endif()
+        endif()
+    endif()
+
+    if(UNIX)
+        get_filename_component(library_path ${ICE_LIB_${LIBRARY}} PATH)
+        link_directories(${library_path})
+    endif()
 endfunction()
 
 # Find a Boost library.
 function(find_Boost_library LIBRARY)
-  if(NOT Boost_FOUND)
-    set(Boost_ADDITIONAL_VERSIONS "1.39" "1.39.0" "1.40" "1.40.0" "1.41" "1.41.0" "1.42" "1.42.0" "1.44" "1.44.0")
-    find_package(Boost)
     if(NOT Boost_FOUND)
-      message(FATAL_ERROR "Boost libraries not found")
-    endif()
-    set(Boost_CORE_FOUND "bazinga" PARENT_SCOPE)
-    set(Boost_CORE_FOUND "bazinga")
-  endif()
-  string(TOUPPER ${LIBRARY} libtag)
-  if(NOT Boost_${libtag}_FOUND)
-    find_package(Boost COMPONENTS ${LIBRARY})
+        set(Boost_ADDITIONAL_VERSIONS "1.39" "1.39.0" "1.40" "1.40.0" "1.41" "1.41.0" "1.42" "1.42.0" "1.44" "1.44.0")
+        find_package(Boost)
+        if(NOT Boost_FOUND)
+            message(FATAL_ERROR "Boost libraries not found")
+        endif()
+        set(Boost_CORE_FOUND "bazinga" PARENT_SCOPE)
+        set(Boost_CORE_FOUND "bazinga")
+    endif()
+    string(TOUPPER ${LIBRARY} libtag)
     if(NOT Boost_${libtag}_FOUND)
-      message(FATAL_ERROR "Failed to find Boost library ${LIBRARY}")
+        find_package(Boost COMPONENTS ${LIBRARY})
+        if(NOT Boost_${libtag}_FOUND)
+            message(FATAL_ERROR "Failed to find Boost library ${LIBRARY}")
+        endif()
     endif()
-  endif()
 endfunction()
 
 # Function which initializes project specific things
 function(asterisk_scf_project NAME ICE_VERSION)
-  message(STATUS "Setting up project ${NAME} for Ice version ${ICE_VERSION}")
-  set(ASTERISK_SCF_ICE_VERSION ${ICE_VERSION} PARENT_SCOPE)
-  project(${NAME} CXX)
-  # On Windows, IceBox C++ services must be compiled with some symbols exported;
-  # the source code should use ASTERISK_SCF_ICEBOX_EXPORT to accomplish this, and this
-  if(WIN32)
-    message(STATUS "Setting ASTERISK_SCF_ICEBOX_EXPORT definition for Windows IceBox services")
-    add_definitions(-DASTERISK_SCF_ICEBOX_EXPORT=__declspec\(dllexport\))
-  else()
-    add_definitions(-DASTERISK_SCF_ICEBOX_EXPORT=)
-  endif()
-  # On Windows, 'debug' libraries should have a "d" suffix to indicate that they
-  # are debug libraries
-  if(WIN32)
-    set(CMAKE_DEBUG_POSTFIX "d" PARENT_SCOPE)
-  endif()
-  find_ICE(${ICE_VERSION})
-  message(STATUS "Performing requirement checks for components")
-  find_ICE_library(Ice)
-  find_ICE_library(IceUtil)
-  if(WIN32)
-    # On Windows, the IceUtil library must be explicitly linked
-    set(ASTERISK_SCF_ICE_LIBRARIES Ice IceUtil PARENT_SCOPE)
-  else()
-    set(ASTERISK_SCF_ICE_LIBRARIES Ice PARENT_SCOPE)
-  endif()
-  message(STATUS "Include directories ${ICE_INCLUDE_DIR}")
-  include_directories("${ICE_INCLUDE_DIR}")
-  message(STATUS "Passed requirement checks for CXX components")
+    message(STATUS "Setting up project ${NAME} for Ice version ${ICE_VERSION}")
+    set(ASTERISK_SCF_ICE_VERSION ${ICE_VERSION} PARENT_SCOPE)
+    project(${NAME} CXX)
+    # On Windows, IceBox C++ services must be compiled with some symbols exported;
+    # the source code should use ASTERISK_SCF_ICEBOX_EXPORT to accomplish this, and this
+    if(WIN32)
+        message(STATUS "Setting ASTERISK_SCF_ICEBOX_EXPORT definition for Windows IceBox services")
+        add_definitions(-DASTERISK_SCF_ICEBOX_EXPORT=__declspec\(dllexport\))
+    else()
+        add_definitions(-DASTERISK_SCF_ICEBOX_EXPORT=)
+    endif()
+    # On Windows, 'debug' libraries should have a "d" suffix to indicate that they
+    # are debug libraries
+    if(WIN32)
+        set(CMAKE_DEBUG_POSTFIX "d" PARENT_SCOPE)
+    endif()
+    find_ICE(${ICE_VERSION})
+    message(STATUS "Performing requirement checks for components")
+    find_ICE_library(Ice)
+    find_ICE_library(IceUtil)
+    if(WIN32)
+        # On Windows, the IceUtil library must be explicitly linked
+        set(ASTERISK_SCF_ICE_LIBRARIES Ice IceUtil PARENT_SCOPE)
+    else()
+        set(ASTERISK_SCF_ICE_LIBRARIES Ice PARENT_SCOPE)
+    endif()
+    message(STATUS "Include directories ${ICE_INCLUDE_DIR}")
+    include_directories("${ICE_INCLUDE_DIR}")
+    message(STATUS "Passed requirement checks for CXX components")
 endfunction()
 
 # Function which adds Ice libraries to all components in the current
 # directory and below
 function(asterisk_scf_add_ice_libraries)
-  if(NOT ARGN)
-    message(FATAL_ERROR "You must pass at least one library to this function")
-  endif()
-  set(libs ${ASTERISK_SCF_ICE_LIBRARIES})
-  foreach(lib ${ARGN})
-    find_ICE_library(${lib})
-    list(APPEND libs ${lib})
-  endforeach()
-  list(REMOVE_DUPLICATES libs)
-  set(ASTERISK_SCF_ICE_LIBRARIES ${libs} PARENT_SCOPE)
+    if(NOT ARGN)
+        message(FATAL_ERROR "You must pass at least one library to this function")
+    endif()
+    set(libs ${ASTERISK_SCF_ICE_LIBRARIES})
+    foreach(lib ${ARGN})
+        find_ICE_library(${lib})
+        list(APPEND libs ${lib})
+    endforeach()
+    list(REMOVE_DUPLICATES libs)
+    set(ASTERISK_SCF_ICE_LIBRARIES ${libs} PARENT_SCOPE)
 endfunction()
 
 # Function which adds Boost libraries to all components in the current
 # directory and below
 function(asterisk_scf_add_boost_libraries)
-  if(NOT ARGN)
-    message(FATAL_ERROR "You must pass at least one library to this function")
-  endif()
-  set(libs ${ASTERISK_SCF_BOOST_LIBRARIES})
-  # By default we are disabling boost auto-linking and specifying dynamic linking. 
-  add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK)  
-  foreach(lib ${ARGN})
-    find_Boost_library(${lib})
-    list(APPEND libs ${lib})
-  endforeach()
-  list(REMOVE_DUPLICATES libs)
-  set(ASTERISK_SCF_BOOST_LIBRARIES ${libs} PARENT_SCOPE)
-  include_directories(${Boost_INCLUDE_DIR})
-  link_directories(${Boost_LIBRARY_DIRS})
+    if(NOT ARGN)
+        message(FATAL_ERROR "You must pass at least one library to this function")
+    endif()
+    set(libs ${ASTERISK_SCF_BOOST_LIBRARIES})
+    # By default we are disabling boost auto-linking and specifying dynamic linking.
+    add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK)
+    foreach(lib ${ARGN})
+        find_Boost_library(${lib})
+        list(APPEND libs ${lib})
+    endforeach()
+    list(REMOVE_DUPLICATES libs)
+    set(ASTERISK_SCF_BOOST_LIBRARIES ${libs} PARENT_SCOPE)
+    include_directories(${Boost_INCLUDE_DIR})
+    link_directories(${Boost_LIBRARY_DIRS})
 endfunction()
 
 # Ensures that a list of paths are all absolute paths.
 macro(ensure_abs_paths pathlist)
-  unset(eap_temp)
-  foreach(p ${${pathlist}})
-    get_filename_component(newpath "${p}" ABSOLUTE)
-    list(APPEND eap_temp "${newpath}")
-  endforeach()
-  list(REMOVE_DUPLICATES eap_temp)
-  set(${pathlist} ${eap_temp})
+    unset(eap_temp)
+    foreach(p ${${pathlist}})
+        get_filename_component(newpath "${p}" ABSOLUTE)
+        list(APPEND eap_temp "${newpath}")
+    endforeach()
+    list(REMOVE_DUPLICATES eap_temp)
+    set(${pathlist} ${eap_temp})
 endmacro()
 
 # Function which remembers include directories needed for a particular Slice target
 function(asterisk_scf_slice_include_directories)
-  set(paths ${ARGN})
-  ensure_abs_paths(paths)
-  if(SLICE_INCLUDE_DIRECTORIES)
-    list(INSERT paths 0 ${SLICE_INCLUDE_DIRECTORIES})
-  endif()
-  list(REMOVE_DUPLICATES paths)
-  set(SLICE_INCLUDE_DIRECTORIES ${paths} PARENT_SCOPE)
+    set(paths ${ARGN})
+    ensure_abs_paths(paths)
+    if(SLICE_INCLUDE_DIRECTORIES)
+        list(INSERT paths 0 ${SLICE_INCLUDE_DIRECTORIES})
+    endif()
+    list(REMOVE_DUPLICATES paths)
+    set(SLICE_INCLUDE_DIRECTORIES ${paths} PARENT_SCOPE)
 endfunction()
 
 # Function which remembers definitions needed for a particular Slice target
 function(asterisk_scf_slice_compile_definitions SLICE_FILE)
-  get_filename_component(SLICE ${SLICE_FILE} NAME_WE)
-  set(SLICE_COMPILE_DEFINITIONS_${SLICE} ${ARGN} PARENT_SCOPE)
+    get_filename_component(SLICE ${SLICE_FILE} NAME_WE)
+    set(SLICE_COMPILE_DEFINITIONS_${SLICE} ${ARGN} PARENT_SCOPE)
 endfunction()
 
 # Function which remembers Ice libraries needed by a Slice target
 function(asterisk_scf_slice_add_ice_libraries TARGET)
-  if(NOT ARGN)
-    message(FATAL_ERROR "You must pass at least one library to this function")
-  endif()
-  set(libs ${${TARGET}_ICE_LIBRARIES})
-  foreach(lib ${ARGN})
-    find_ICE_library(${lib})
-    list(APPEND libs ${lib})
-  endforeach()
-  list(REMOVE_DUPLICATES libs)
-  set(${TARGET}_ICE_LIBRARIES ${libs} PARENT_SCOPE)
+    if(NOT ARGN)
+        message(FATAL_ERROR "You must pass at least one library to this function")
+    endif()
+    set(libs ${${TARGET}_ICE_LIBRARIES})
+    foreach(lib ${ARGN})
+        find_ICE_library(${lib})
+        list(APPEND libs ${lib})
+    endforeach()
+    list(REMOVE_DUPLICATES libs)
+    set(${TARGET}_ICE_LIBRARIES ${libs} PARENT_SCOPE)
 endfunction()
 
 # Function which adds a dependency for a Slice definition
 function(asterisk_scf_slice_add_dependencies TARGET)
-  if(NOT ARGN)
-    message(FATAL_ERROR "You must pass at least one dependency to this function")
-  endif()
-  foreach(d ${ARGN})
-    message(STATUS "Adding dependency on slice definition ${d} to ${TARGET}")
-    add_dependencies(${TARGET}_${l} ${d}_${l})
-  endforeach()
+    if(NOT ARGN)
+        message(FATAL_ERROR "You must pass at least one dependency to this function")
+    endif()
+    foreach(d ${ARGN})
+        message(STATUS "Adding dependency on slice definition ${d} to ${TARGET}")
+        add_dependencies(${TARGET}_${l} ${d}_${l})
+    endforeach()
 endfunction()
 
 # Function which compiles one or more Slice definition files
@@ -477,436 +477,436 @@ endfunction()
 # ASTERISK_SCF_SLICE_${SLICE}_INCLUDE_DIRS
 #  directories where generated header files needed for this target live
 function(asterisk_scf_compile_slice TARGET_IN DIR_IN DESC_IN GROUP_IN)
-  if(ARGN)
-    foreach(arg ${ARGN})
-      if(NOT source_mode)
-	if(arg STREQUAL "SOURCES")
-	  set(source_mode true)
-	else()
-	  message(FATAL_ERROR "Unsupported argument '${arg}' passed to asterisk_scf_compile_slice")
-	endif()
-      else()
-	list(APPEND inputs "${arg}")
-      endif()
+    if(ARGN)
+        foreach(arg ${ARGN})
+            if(NOT source_mode)
+	        if(arg STREQUAL "SOURCES")
+	            set(source_mode true)
+	        else()
+	            message(FATAL_ERROR "Unsupported argument '${arg}' passed to asterisk_scf_compile_slice")
+	        endif()
+            else()
+	        list(APPEND inputs "${arg}")
+            endif()
+        endforeach()
+        set(TARGET "${TARGET_IN}")
+    else()
+        set(slice_files "${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_IN}")
+        get_filename_component(file "${TARGET_IN}" NAME_WE)
+        set(TARGET "${file}")
+    endif()
+
+    # Now that we have the list of inputs, convert any of them
+    # that are glob-patterns into the list of files that match
+    if(source_mode)
+        foreach(input ${inputs})
+            if(IS_ABSOLUTE "${input}")
+	        file(GLOB globbed "${input}")
+            else()
+	        file(GLOB globbed "${CMAKE_CURRENT_SOURCE_DIR}/${input}")
+            endif()
+            if(globbed)
+	        foreach (glob ${globbed})
+	            file(TO_CMAKE_PATH "${glob}" cmake_path)
+	            if(glob MATCHES "\\.ice$")
+	                list(APPEND slice_files "${cmake_path}")
+	            endif()
+	            if(glob MATCHES "\\.h$")
+	                list(APPEND cpp_header_files "${cmake_path}")
+	            endif()
+	            if(glob MATCHES "\\.cpp$")
+	                list(APPEND cpp_source_files "${cmake_path}")
+	            endif()
+	        endforeach()
+            else()
+	        if(input MATCHES "\\.ice$")
+	            list(APPEND slice_files "${input}")
+	        endif()
+            endif()
+        endforeach()
+    endif()
+
+    # This makes the Slice definitions display in their own folder in the IDE,
+    # specifically Visual Studio
+    source_group("Slice Definitions" REGULAR_EXPRESSION "\\.ice$")
+
+    # Append the needed include directories for Slice definitions
+    # (global and the ones stored for this target)
+    if(ICE_SLICE_DIR)
+        list(APPEND slice_compiler_arguments "-I${ICE_SLICE_DIR}")
+    endif()
+    foreach(include ${SLICE_INCLUDE_DIRECTORIES})
+        # Each directory in this list will be in the source tree,
+        # which is what the Slice compiler will need
+        list(APPEND slice_compiler_arguments "-I${include}")
+        # If there are any CXX targets that depend on this target,
+        # they'll need a path to the *parallel* directory in the build
+        # tree where the Slice compiler will have generated the
+        # header file(s) for the Slice definitions in the source tree
+        # but only if the Slice include path is actually part of the
+        # source tree... if it's not, it is assumed that the relevant
+        # header files live in the same directory as the Slice files
+        file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${include}")
+        if(relpath MATCHES "^../")
+            # The directory is not located in the source tree, so use the
+            # original path
+            list(APPEND target_includes "${include}")
+        else()
+            # The directory is located in the source tree, so use the
+            # parallel path in the build tree
+            list(APPEND target_includes "${CMAKE_BINARY_DIR}/${relpath}")
+        endif()
     endforeach()
-    set(TARGET "${TARGET_IN}")
-  else()
-    set(slice_files "${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_IN}")
-    get_filename_component(file "${TARGET_IN}" NAME_WE)
-    set(TARGET "${file}")
-  endif()
-
-  # Now that we have the list of inputs, convert any of them
-  # that are glob-patterns into the list of files that match
-  if(source_mode)
-    foreach(input ${inputs})
-      if(IS_ABSOLUTE "${input}")
-	file(GLOB globbed "${input}")
-      else()
-	file(GLOB globbed "${CMAKE_CURRENT_SOURCE_DIR}/${input}")
-      endif()
-      if(globbed)
-	foreach (glob ${globbed})
-	  file(TO_CMAKE_PATH "${glob}" cmake_path)
-	  if(glob MATCHES "\\.ice$")
-	    list(APPEND slice_files "${cmake_path}")
-	  endif()
-	  if(glob MATCHES "\\.h$")
-	    list(APPEND cpp_header_files "${cmake_path}")
-	  endif()
-	  if(glob MATCHES "\\.cpp$")
-	    list(APPEND cpp_source_files "${cmake_path}")
-	  endif()
-	endforeach()
-      else()
-	if(input MATCHES "\\.ice$")
-	  list(APPEND slice_files "${input}")
-	endif()
-      endif()
+
+    # Append any definitions stored for this target
+    foreach(SLICEDEF ${SLICE_COMPILE_DEFINITIONS_${TARGET}})
+        list(APPEND slice_compiler_arguments "-D${SLICEDEF}")
     endforeach()
-  endif()
-
-  # This makes the Slice definitions display in their own folder in the IDE,
-  # specifically Visual Studio
-  source_group("Slice Definitions" REGULAR_EXPRESSION "\\.ice$")
-
-  # Append the needed include directories for Slice definitions
-  # (global and the ones stored for this target)
-  if(ICE_SLICE_DIR)
-    list(APPEND slice_compiler_arguments "-I${ICE_SLICE_DIR}")
-  endif()
-  foreach(include ${SLICE_INCLUDE_DIRECTORIES})
-    # Each directory in this list will be in the source tree,
-    # which is what the Slice compiler will need
-    list(APPEND slice_compiler_arguments "-I${include}")
-    # If there are any CXX targets that depend on this target,
-    # they'll need a path to the *parallel* directory in the build
-    # tree where the Slice compiler will have generated the
-    # header file(s) for the Slice definitions in the source tree
-    # but only if the Slice include path is actually part of the
-    # source tree... if it's not, it is assumed that the relevant
-    # header files live in the same directory as the Slice files
-    file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${include}")
-    if(relpath MATCHES "^../")
-      # The directory is not located in the source tree, so use the
-      # original path
-      list(APPEND target_includes "${include}")
-    else()
-      # The directory is located in the source tree, so use the
-      # parallel path in the build tree
-      list(APPEND target_includes "${CMAKE_BINARY_DIR}/${relpath}")
-    endif()
-  endforeach()
-
-  # Append any definitions stored for this target
-  foreach(SLICEDEF ${SLICE_COMPILE_DEFINITIONS_${TARGET}})
-    list(APPEND slice_compiler_arguments "-D${SLICEDEF}")
-  endforeach()
-  list(REMOVE_DUPLICATES slice_compiler_arguments)
-
-  foreach(file ${slice_files})
-    file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${file}")
-    string(REPLACE "/" "_" file_variable ${relpath})
-    set_cache_var(TARGET_${file_variable} ${TARGET})
-  endforeach()
-
-  message(STATUS "Building Slice target ${TARGET} as a library")
-  set(suffixes cpp h)
-  include_directories("${CMAKE_CURRENT_BINARY_DIR}")
-
-  if(NOT SLICE_COMPILER)
-    # Find the actual Slice compiler
-    find_program(SLICE_COMPILER slice2cpp PATHS "${ICE_DIR}/bin" NO_DEFAULT_PATH)
-
-    # If we fail to find it we have to abort here, we can go no further
-    if(SLICE_COMPILER)
-      message(STATUS "Found Slice compiler at ${SLICE_COMPILER}")
-    else()
-      message(FATAL_ERROR "Failed to find Slice compiler")
-    endif()
-  endif()
-
-  # Look for the dependencies for this slice definition, we have to do it now since the target was just added
-  message(STATUS "Determining dependencies for Slice target ${TARGET}")
-  execute_process(COMMAND ${SLICE_COMPILER} ${slice_compiler_arguments}
-    --depend ${slice_files} OUTPUT_VARIABLE raw_dependencies
-    ERROR_VARIABLE slice_errors)
-  if(slice_errors)
-    message(FATAL_ERROR "Slice compiler produced errors:\n ${slice_errors}")
-  endif()
-
-  if(raw_dependencies)
-    # The next block of stuff sanitizes the output we got from the slice compiler into a non-Makefile specific foo
-    # Get rid of all the \ characters
-    string(REPLACE "\\" "" raw_dependencies "${raw_dependencies}")
-    # Turn the newlines into CMake list item separators, since the compiler spits out one dependency per line
-    string(REPLACE "\n" ";" raw_dependencies "${raw_dependencies}")
-    string(REPLACE " ;" ";" raw_dependencies "${raw_dependencies}")
-    string(REPLACE "; " ";" raw_dependencies "${raw_dependencies}")
-    
-    foreach(dep ${raw_dependencies})
-      # If the name ends with a colon, it's actually a Makefile target name and should be
-      # skipped
-      if(NOT dep MATCHES ":$")
-        # Convert the path into a cmake one so we can absolutely get the filename
-	file(TO_CMAKE_PATH ${dep} dep)
-	file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${dep}")
-	string(REPLACE "/" "_" file_variable "${relpath}")
-	set(dep_target ${TARGET_${file_variable}})
-	if(dep_target)
-	  # If this is not already us add it as a dependency
-	  if(NOT dep_target STREQUAL ${TARGET})
-	    message(STATUS "Auto-adding dependency on Slice target ${dep_target} to ${TARGET}")
-	    list(APPEND source_dependencies ${dep})
-	    list(APPEND target_dependencies ${dep_target})
-	    list(APPEND target_includes ${ASTERISK_SCF_SLICE_${dep_target}_INCLUDE_DIRS})
-	  endif()
-	else()
-	  # Remember sources that are not associated with targets too
-	  message(STATUS "Auto-adding dependency on Slice source ${dep} to ${TARGET}")
-	  list(APPEND source_dependencies ${dep})
-	endif()
-      endif()
+    list(REMOVE_DUPLICATES slice_compiler_arguments)
+
+    foreach(file ${slice_files})
+        file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${file}")
+        string(REPLACE "/" "_" file_variable ${relpath})
+        set_cache_var(TARGET_${file_variable} ${TARGET})
+    endforeach()
+
+    message(STATUS "Building Slice target ${TARGET} as a library")
+    set(suffixes cpp h)
+    include_directories("${CMAKE_CURRENT_BINARY_DIR}")
+
+    if(NOT SLICE_COMPILER)
+        # Find the actual Slice compiler
+        find_program(SLICE_COMPILER slice2cpp PATHS "${ICE_DIR}/bin" NO_DEFAULT_PATH)
+
+        # If we fail to find it we have to abort here, we can go no further
+        if(SLICE_COMPILER)
+            message(STATUS "Found Slice compiler at ${SLICE_COMPILER}")
+        else()
+            message(FATAL_ERROR "Failed to find Slice compiler")
+        endif()
+    endif()
+
+    # Look for the dependencies for this slice definition, we have to do it now since the target was just added
+    message(STATUS "Determining dependencies for Slice target ${TARGET}")
+    execute_process(COMMAND ${SLICE_COMPILER} ${slice_compiler_arguments}
+        --depend ${slice_files} OUTPUT_VARIABLE raw_dependencies
+        ERROR_VARIABLE slice_errors)
+    if(slice_errors)
+        message(FATAL_ERROR "Slice compiler produced errors:\n ${slice_errors}")
+    endif()
+
+    if(raw_dependencies)
+        # The next block of stuff sanitizes the output we got from the slice compiler into a non-Makefile specific foo
+        # Get rid of all the \ characters
+        string(REPLACE "\\" "" raw_dependencies "${raw_dependencies}")
+        # Turn the newlines into CMake list item separators, since the compiler spits out one dependency per line
+        string(REPLACE "\n" ";" raw_dependencies "${raw_dependencies}")
+        string(REPLACE " ;" ";" raw_dependencies "${raw_dependencies}")
+        string(REPLACE "; " ";" raw_dependencies "${raw_dependencies}")
+
+        foreach(dep ${raw_dependencies})
+            # If the name ends with a colon, it's actually a Makefile target name and should be
+            # skipped
+            if(NOT dep MATCHES ":$")
+                # Convert the path into a cmake one so we can absolutely get the filename
+	        file(TO_CMAKE_PATH ${dep} dep)
+	        file(RELATIVE_PATH relpath "${CMAKE_SOURCE_DIR}" "${dep}")
+	        string(REPLACE "/" "_" file_variable "${relpath}")
+	        set(dep_target ${TARGET_${file_variable}})
+	        if(dep_target)
+	            # If this is not already us add it as a dependency
+	            if(NOT dep_target STREQUAL ${TARGET})
+	                message(STATUS "Auto-adding dependency on Slice target ${dep_target} to ${TARGET}")
+	                list(APPEND source_dependencies ${dep})
+	                list(APPEND target_dependencies ${dep_target})
+	                list(APPEND target_includes ${ASTERISK_SCF_SLICE_${dep_target}_INCLUDE_DIRS})
+	            endif()
+	        else()
+	            # Remember sources that are not associated with targets too
+	            message(STATUS "Auto-adding dependency on Slice source ${dep} to ${TARGET}")
+	            list(APPEND source_dependencies ${dep})
+	        endif()
+            endif()
+        endforeach()
+    endif()
+
+    foreach(file ${slice_files})
+        foreach(suffix ${suffixes})
+            get_filename_component(source "${file}" NAME_WE)
+            list(APPEND generated_files "${CMAKE_CURRENT_BINARY_DIR}/${source}.${suffix}")
+        endforeach()
     endforeach()
-  endif()
 
-  foreach(file ${slice_files})
-    foreach(suffix ${suffixes})
-      get_filename_component(source "${file}" NAME_WE)
-      list(APPEND generated_files "${CMAKE_CURRENT_BINARY_DIR}/${source}.${suffix}")
+    set_source_files_properties(${generated_files} PROPERTIES GENERATED 1)
+
+    # create a preprocessor definition in the generated CXX files that enables
+    # the generated classes to be exported from the library (only necessary on Windows)
+    # the definition for a target named 'FOO' will be 'FOO_EXPORTS', and if this
+    # preprocessor macro is defined, then the Slice-generated classes will be marked
+    # with 'dllexport'. add_library() (used below) automatically generates a definition
+    # for the appropriately-named macro when the library is built in SHARED mode.
+    if(WIN32)
+        list(APPEND slice_export_arguments "--dll-export" "${TARGET}")
+    endif()
+
+    add_custom_command(
+        OUTPUT ${generated_files}
+        COMMAND ${SLICE_COMPILER} ${slice_compiler_arguments} ${slice_export_arguments} ${slice_files}
+        COMMENT "Building ${TARGET} from ${slice_files} using slice2cpp"
+        DEPENDS ${slice_files} ${source_dependencies}
+        )
+
+    if(target_includes)
+        list(REMOVE_DUPLICATES target_includes)
+    endif()
+
+    # Note that slice_files are included as sources here even though they won't be compiled
+    # by the actual compiler; this is to get them to show up as sources in the project
+    # created for this target
+    include_directories(${target_includes})
+    # If there are any non-generated header files required for this Slice target, copy
+    # them to the binary directory where they will be needed later. The destination
+    # path to file() defaults to the binary directory, so there is no need to
+    # re-specify it here.
+    if(cpp_header_files)
+        file(COPY ${cpp_header_files} DESTINATION .)
+    endif()
+    add_library(${TARGET} ${generated_files} ${slice_files} ${cpp_source_files})
+    install(TARGETS ${TARGET} DESTINATION ${DIR_IN} COMPONENT ${TARGET})
+    if(ASTERISKSCF_CPACK)
+        # Adds a component to the packager. The first arg must have been previously defined
+        # as a COMPONENT arg to install.
+        cpack_add_component(${TARGET} DESCRIPTION ${DESC_IN} GROUP ${GROUP_IN})
+    endif()
+    foreach(lib ${${TARGET}_ICE_LIBRARIES} ${ASTERISK_SCF_ICE_LIBRARIES})
+        if(UNIX)
+            list(APPEND target_libs "${lib}")
+        else()
+            list(APPEND target_libs "${ICE_LIB_${lib}}")
+        endif()
     endforeach()
-  endforeach()
-
-  set_source_files_properties(${generated_files} PROPERTIES GENERATED 1)
-
-  # create a preprocessor definition in the generated CXX files that enables
-  # the generated classes to be exported from the library (only necessary on Windows)
-  # the definition for a target named 'FOO' will be 'FOO_EXPORTS', and if this
-  # preprocessor macro is defined, then the Slice-generated classes will be marked
-  # with 'dllexport'. add_library() (used below) automatically generates a definition
-  # for the appropriately-named macro when the library is built in SHARED mode.
-  if(WIN32)
-    list(APPEND slice_export_arguments "--dll-export" "${TARGET}")
-  endif()
-
-  add_custom_command(
-    OUTPUT ${generated_files}
-    COMMAND ${SLICE_COMPILER} ${slice_compiler_arguments} ${slice_export_arguments} ${slice_files}
-    COMMENT "Building ${TARGET} from ${slice_files} using slice2cpp"
-    DEPENDS ${slice_files} ${source_dependencies}
-    )
-
-  if(target_includes)
-    list(REMOVE_DUPLICATES target_includes)
-  endif()
-
-  # Note that slice_files are included as sources here even though they won't be compiled
-  # by the actual compiler; this is to get them to show up as sources in the project
-  # created for this target
-  include_directories(${target_includes})
-  # If there are any non-generated header files required for this Slice target, copy
-  # them to the binary directory where they will be needed later. The destination
-  # path to file() defaults to the binary directory, so there is no need to
-  # re-specify it here.
-  if(cpp_header_files)
-    file(COPY ${cpp_header_files} DESTINATION .)
-  endif()
-  add_library(${TARGET} ${generated_files} ${slice_files} ${cpp_source_files})
-  install(TARGETS ${TARGET} DESTINATION ${DIR_IN} COMPONENT ${TARGET})
-  if(ASTERISKSCF_CPACK)
-    # Adds a component to the packager. The first arg must have been previously defined
-    # as a COMPONENT arg to install.
-    cpack_add_component(${TARGET} DESCRIPTION ${DESC_IN} GROUP ${GROUP_IN})
-  endif()
-  foreach(lib ${${TARGET}_ICE_LIBRARIES} ${ASTERISK_SCF_ICE_LIBRARIES})
+    if(target_libs)
+        target_link_libraries(${TARGET} ${target_libs})
+    endif()
+    if(APPLE)
+        target_link_libraries(${TARGET} ${ICE_LIB_IceUtil})
+        target_link_libraries(${TARGET} ${ICE_LIB_ZeroCIce})
+    endif()
+    if(target_dependencies)
+        message(STATUS "Linking ${TARGET} to ${target_dependencies}")
+        target_link_libraries(${TARGET} ${target_dependencies})
+        add_dependencies(${TARGET} ${target_dependencies})
+    endif()
     if(UNIX)
-      list(APPEND target_libs "${lib}")
-    else()
-      list(APPEND target_libs "${ICE_LIB_${lib}}")
-    endif()
-  endforeach()
-  if(target_libs)
-    target_link_libraries(${TARGET} ${target_libs})
-  endif()
-  if(APPLE)
-    target_link_libraries(${TARGET} ${ICE_LIB_IceUtil})
-    target_link_libraries(${TARGET} ${ICE_LIB_ZeroCIce})
-  endif()
-  if(target_dependencies)
-    message(STATUS "Linking ${TARGET} to ${target_dependencies}")
-    target_link_libraries(${TARGET} ${target_dependencies})
-    add_dependencies(${TARGET} ${target_dependencies})
-  endif()
-  if(UNIX)
-    set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS "-fPIC")
-  endif()
-  set_cache_var(ASTERISK_SCF_SLICE_${TARGET}_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${target_includes})
-  set_cache_var(ASTERISK_SCF_SLICE_${TARGET} Bob)
+        set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS "-fPIC")
+    endif()
+    set_cache_var(ASTERISK_SCF_SLICE_${TARGET}_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${target_includes})
+    set_cache_var(ASTERISK_SCF_SLICE_${TARGET} Bob)
 endfunction()
 
 # Function which initializes a component for building
 function(asterisk_scf_component_init COMPONENT)
-  message(STATUS "Setting up to build component ${COMPONENT}")
-  set(ASTERISK_SCF_${COMPONENT} Bob PARENT_SCOPE)
+    message(STATUS "Setting up to build component ${COMPONENT}")
+    set(ASTERISK_SCF_${COMPONENT} Bob PARENT_SCOPE)
 endfunction()
 
 # Function which adds the compiled Slice targets to a component to be built
 function(asterisk_scf_component_add_slice COMPONENT)
-  if(NOT ARGN)
-    message(FATAL_ERROR "You must pass at least one Slice target to this function")
-  endif()
-  if(NOT ASTERISK_SCF_${COMPONENT})
-    message(FATAL_ERROR "Must call asterisk_scf_component_init for component ${COMPONENT} before asterisk_scf_component_add_slice")
-  endif()
-  set(slice_list ${${COMPONENT}_SLICES})
-  foreach(slice ${ARGN})
-    get_filename_component(f ${slice} NAME_WE)
-    if(NOT ASTERISK_SCF_SLICE_${f})
-      message(FATAL_ERROR "Must call asterisk_scf_compile_slice for ${f} before asterisk_scf_component_add_slice")
-    endif()
-    message(STATUS "Adding Slice ${f} to component ${COMPONENT}")
-    list(APPEND slice_list ${f})
-    list(APPEND include_dirs ${ASTERISK_SCF_SLICE_${slice}_INCLUDE_DIRS})
-  endforeach()
-  list(REMOVE_DUPLICATES slice_list)
-  set(${COMPONENT}_SLICES ${slice_list} PARENT_SCOPE)
-  if(include_dirs)
-    list(REMOVE_DUPLICATES include_dirs)
-    include_directories(${include_dirs})
-  endif()
+    if(NOT ARGN)
+        message(FATAL_ERROR "You must pass at least one Slice target to this function")
+    endif()
+    if(NOT ASTERISK_SCF_${COMPONENT})
+        message(FATAL_ERROR "Must call asterisk_scf_component_init for component ${COMPONENT} before asterisk_scf_component_add_slice")
+    endif()
+    set(slice_list ${${COMPONENT}_SLICES})
+    foreach(slice ${ARGN})
+        get_filename_component(f ${slice} NAME_WE)
+        if(NOT ASTERISK_SCF_SLICE_${f})
+            message(FATAL_ERROR "Must call asterisk_scf_compile_slice for ${f} before asterisk_scf_component_add_slice")
+        endif()
+        message(STATUS "Adding Slice ${f} to component ${COMPONENT}")
+        list(APPEND slice_list ${f})
+        list(APPEND include_dirs ${ASTERISK_SCF_SLICE_${slice}_INCLUDE_DIRS})
+    endforeach()
+    list(REMOVE_DUPLICATES slice_list)
+    set(${COMPONENT}_SLICES ${slice_list} PARENT_SCOPE)
+    if(include_dirs)
+        list(REMOVE_DUPLICATES include_dirs)
+        include_directories(${include_dirs})
+    endif()
 endfunction()
 
 # Function which adds source or header files to a component to be built
 function(asterisk_scf_component_add_file COMPONENT)
-  if(NOT ARGN)
-    message(FATAL_ERROR "You must pass at least one source file to this function")
-  endif()
-  message(STATUS "Adding ${ARGN} to component ${COMPONENT}")
-  set(file_list ${${COMPONENT}_SOURCES})
-  foreach(file ${ARGN})
-    list(APPEND file_list ${CMAKE_CURRENT_SOURCE_DIR}/${file})
-  endforeach()
-  list(REMOVE_DUPLICATES file_list)
-  set(${COMPONENT}_SOURCES ${file_list} PARENT_SCOPE)
+    if(NOT ARGN)
+        message(FATAL_ERROR "You must pass at least one source file to this function")
+    endif()
+    message(STATUS "Adding ${ARGN} to component ${COMPONENT}")
+    set(file_list ${${COMPONENT}_SOURCES})
+    foreach(file ${ARGN})
+        list(APPEND file_list ${CMAKE_CURRENT_SOURCE_DIR}/${file})
+    endforeach()
+    list(REMOVE_DUPLICATES file_list)
+    set(${COMPONENT}_SOURCES ${file_list} PARENT_SCOPE)
 endfunction()
 
 # Function which adds Ice libraries needed by a component
 function(asterisk_scf_component_add_ice_libraries COMPONENT)
-  if(NOT ARGN)
-    message(FATAL_ERROR "You must pass at least one library to this function")
-  endif()
-  set(libs ${${COMPONENT}_ICE_LIBRARIES})
-  foreach(lib ${ARGN})
-    find_ICE_library(${lib})
-    list(APPEND libs ${lib})
-  endforeach()
-  list(REMOVE_DUPLICATES libs)
-  set(${COMPONENT}_ICE_LIBRARIES ${libs} PARENT_SCOPE)
+    if(NOT ARGN)
+        message(FATAL_ERROR "You must pass at least one library to this function")
+    endif()
+    set(libs ${${COMPONENT}_ICE_LIBRARIES})
+    foreach(lib ${ARGN})
+        find_ICE_library(${lib})
+        list(APPEND libs ${lib})
+    endforeach()
+    list(REMOVE_DUPLICATES libs)
+    set(${COMPONENT}_ICE_LIBRARIES ${libs} PARENT_SCOPE)
 endfunction()
 
 # Function which adds Boost libraries needed by a component
 function(asterisk_scf_component_add_boost_libraries COMPONENT)
-  if(NOT ARGN)
-    message(FATAL_ERROR "You must pass at least one library to this function")
-  endif()
-  set(libs ${${COMPONENT}_BOOST_LIBRARIES})
-  # By default we are disabling boost auto-linking and specifying dynamic linking. 
-  add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK)  
-  foreach(lib ${ARGN})
-    find_Boost_library(${lib})
-    list(APPEND libs ${lib})
-  endforeach()
-  list(REMOVE_DUPLICATES libs)
-  set(${COMPONENT}_BOOST_LIBRARIES ${libs} PARENT_SCOPE)
-  include_directories(${Boost_INCLUDE_DIR})
-  link_directories(${Boost_LIBRARY_DIRS})
+    if(NOT ARGN)
+        message(FATAL_ERROR "You must pass at least one library to this function")
+    endif()
+    set(libs ${${COMPONENT}_BOOST_LIBRARIES})
+    # By default we are disabling boost auto-linking and specifying dynamic linking.
+    add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK)
+    foreach(lib ${ARGN})
+        find_Boost_library(${lib})
+        list(APPEND libs ${lib})
+    endforeach()
+    list(REMOVE_DUPLICATES libs)
+    set(${COMPONENT}_BOOST_LIBRARIES ${libs} PARENT_SCOPE)
+    include_directories(${Boost_INCLUDE_DIR})
+    link_directories(${Boost_LIBRARY_DIRS})
 endfunction()
 
 # Function which builds a component as an IceBox service
 function(asterisk_scf_component_build_icebox COMPONENT)
-  message(STATUS "Building component ${COMPONENT} as an IceBox service")
-  find_ICE_library(IceBox)
-  list(APPEND icelibs IceBox ${ASTERISK_SCF_ICE_LIBRARIES} ${${COMPONENT}_ICE_LIBRARIES})
-  list(REMOVE_DUPLICATES icelibs)
-  foreach(lib ${icelibs})
-    if(UNIX)
-      list(APPEND target_libs "${lib}")
-    else()
-      list(APPEND target_libs "${ICE_LIB_${lib}}")
-    endif()
-  endforeach()
-
-  # Now we actually create the library
-  # while one would think that MODULE would be the right setting, it
-  # has to be shared due to how icebox finds these libraries on a Mac
-  # (it loads .dylib instead of loading .so)
-  add_library(${COMPONENT} SHARED ${${COMPONENT}_SOURCES})
-  # Link required libraries and Slice libraries
-  list(APPEND boostlibs ${ASTERISK_SCF_BOOST_LIBRARIES} ${${COMPONENT}_BOOST_LIBRARIES})
-  if(boostlibs)
-    list(REMOVE_DUPLICATES boostlibs)
-    foreach(lib ${boostlibs})
-      string(TOUPPER ${lib} libtag)
-      list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
+    message(STATUS "Building component ${COMPONENT} as an IceBox service")
+    find_ICE_library(IceBox)
+    list(APPEND icelibs IceBox ${ASTERISK_SCF_ICE_LIBRARIES} ${${COMPONENT}_ICE_LIBRARIES})
+    list(REMOVE_DUPLICATES icelibs)
+    foreach(lib ${icelibs})
+        if(UNIX)
+            list(APPEND target_libs "${lib}")
+        else()
+            list(APPEND target_libs "${ICE_LIB_${lib}}")
+        endif()
     endforeach()
-  endif()
-  if(UNIX)
-    list(FIND target_libs Ice _Ice_FOUND)
-    if(_Ice_FOUND GREATER -1)
-      list(APPEND target_libs "IceUtil")
-      list(APPEND target_libs "pthread")
-    endif()
-  endif()
-  target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
+
+    # Now we actually create the library
+    # while one would think that MODULE would be the right setting, it
+    # has to be shared due to how icebox finds these libraries on a Mac
+    # (it loads .dylib instead of loading .so)
+    add_library(${COMPONENT} SHARED ${${COMPONENT}_SOURCES})
+    # Link required libraries and Slice libraries
+    list(APPEND boostlibs ${ASTERISK_SCF_BOOST_LIBRARIES} ${${COMPONENT}_BOOST_LIBRARIES})
+    if(boostlibs)
+        list(REMOVE_DUPLICATES boostlibs)
+        foreach(lib ${boostlibs})
+            string(TOUPPER ${lib} libtag)
+            list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
+        endforeach()
+    endif()
+    if(UNIX)
+        list(FIND target_libs Ice _Ice_FOUND)
+        if(_Ice_FOUND GREATER -1)
+            list(APPEND target_libs "IceUtil")
+            list(APPEND target_libs "pthread")
+        endif()
+    endif()
+    target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
 endfunction()
 
 # Function which builds a component standalone
 function(asterisk_scf_component_build_standalone COMPONENT)
-  message(STATUS "Building component ${COMPONENT} as a standalone executable")
-  list(APPEND icelibs ${ASTERISK_SCF_ICE_LIBRARIES} ${${COMPONENT}_ICE_LIBRARIES})
-  list(REMOVE_DUPLICATES icelibs)
-  foreach(lib ${icelibs})
-    if(UNIX)
-      list(APPEND target_libs "${lib}")
-    else()
-      list(APPEND target_libs "${ICE_LIB_${lib}}")
-    endif()
-  endforeach()
-
-  # Now we actually create the component
-  add_executable(${COMPONENT} ${${COMPONENT}_SOURCES})
-  # Link required libraries and Slice libraries
-  list(APPEND boostlibs ${ASTERISK_SCF_BOOST_LIBRARIES} ${${COMPONENT}_BOOST_LIBRARIES})
-  if(boostlibs)
-    list(REMOVE_DUPLICATES boostlibs)
-    foreach(lib ${boostlibs})
-      string(TOUPPER ${lib} libtag)
-      list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
+    message(STATUS "Building component ${COMPONENT} as a standalone executable")
+    list(APPEND icelibs ${ASTERISK_SCF_ICE_LIBRARIES} ${${COMPONENT}_ICE_LIBRARIES})
+    list(REMOVE_DUPLICATES icelibs)
+    foreach(lib ${icelibs})
+        if(UNIX)
+            list(APPEND target_libs "${lib}")
+        else()
+            list(APPEND target_libs "${ICE_LIB_${lib}}")
+        endif()
     endforeach()
-  endif()
-  if(UNIX)
-    list(FIND target_libs Ice _Ice_FOUND)
-    if(_Ice_FOUND GREATER -1)
-      list(APPEND target_libs "IceUtil")
-      list(APPEND target_libs "pthread")
-    endif()
-  endif()
-  target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
+
+    # Now we actually create the component
+    add_executable(${COMPONENT} ${${COMPONENT}_SOURCES})
+    # Link required libraries and Slice libraries
+    list(APPEND boostlibs ${ASTERISK_SCF_BOOST_LIBRARIES} ${${COMPONENT}_BOOST_LIBRARIES})
+    if(boostlibs)
+        list(REMOVE_DUPLICATES boostlibs)
+        foreach(lib ${boostlibs})
+            string(TOUPPER ${lib} libtag)
+            list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
+        endforeach()
+    endif()
+    if(UNIX)
+        list(FIND target_libs Ice _Ice_FOUND)
+        if(_Ice_FOUND GREATER -1)
+            list(APPEND target_libs "IceUtil")
+            list(APPEND target_libs "pthread")
+        endif()
+    endif()
+    target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
 endfunction()
 
 function(asterisk_scf_component_build_library COMPONENT)
-  message(STATUS "Building component ${COMPONENT} as a library")
-  list(APPEND icelibs ${ASTERISK_SCF_ICE_LIBRARIES} ${${COMPONENT}_ICE_LIBRARIES})
-  list(LENGTH icelibs numicelibs)
-  if(numicelibs GREATER 0)
-    list(REMOVE_DUPLICATES icelibs)
-  endif()
-  foreach(lib ${icelibs})
-    if(UNIX)
-      list(APPEND target_libs "${lib}")
-    else()
-      list(APPEND target_libs "${ICE_LIB_${lib}}")
-    endif()
-  endforeach()
-
-  # Now we actually create the component
-  add_library(${COMPONENT} ${${COMPONENT}_SOURCES})
-  # Link required libraries and Slice libraries
-  list(APPEND boostlibs ${ASTERISK_SCF_BOOST_LIBRARIES} ${${COMPONENT}_BOOST_LIBRARIES})
-  if(boostlibs)
-    list(REMOVE_DUPLICATES boostlibs)
-    foreach(lib ${boostlibs})
-      string(TOUPPER ${lib} libtag)
-      list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
+    message(STATUS "Building component ${COMPONENT} as a library")
+    list(APPEND icelibs ${ASTERISK_SCF_ICE_LIBRARIES} ${${COMPONENT}_ICE_LIBRARIES})
+    list(LENGTH icelibs numicelibs)
+    if(numicelibs GREATER 0)
+        list(REMOVE_DUPLICATES icelibs)
+    endif()
+    foreach(lib ${icelibs})
+        if(UNIX)
+            list(APPEND target_libs "${lib}")
+        else()
+            list(APPEND target_libs "${ICE_LIB_${lib}}")
+        endif()
     endforeach()
-  endif()
-  target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
+
+    # Now we actually create the component
+    add_library(${COMPONENT} ${${COMPONENT}_SOURCES})
+    # Link required libraries and Slice libraries
+    list(APPEND boostlibs ${ASTERISK_SCF_BOOST_LIBRARIES} ${${COMPONENT}_BOOST_LIBRARIES})
+    if(boostlibs)
+        list(REMOVE_DUPLICATES boostlibs)
+        foreach(lib ${boostlibs})
+            string(TOUPPER ${lib} libtag)
+            list(APPEND target_libs "${Boost_${libtag}_LIBRARY}")
+        endforeach()
+    endif()
+    target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
 endfunction()
 
 # Function which adds information for installing a component
 function(asterisk_scf_component_install COMPONENTNAME TYPE DIR DESC GROUP)
-  install(TARGETS ${COMPONENTNAME} ${TYPE} DESTINATION ${DIR} COMPONENT ${COMPONENTNAME} ${ARGN})
+    install(TARGETS ${COMPONENTNAME} ${TYPE} DESTINATION ${DIR} COMPONENT ${COMPONENTNAME} ${ARGN})
 
-  if(ASTERISKSCF_CPACK)
-    asterisk_scf_component_package(${COMPONENTNAME} ${DESC} ${GROUP})
-  endif()
+    if(ASTERISKSCF_CPACK)
+        asterisk_scf_component_package(${COMPONENTNAME} ${DESC} ${GROUP})
+    endif()
 endfunction()
 
 # Adds a component to the packager. COMPONENTNAME must have been previously defined
 # via the install command.
 function(asterisk_scf_component_package COMPONENTNAME DESC GROUPNAME)
-  cpack_add_component(${COMPONENTNAME} DESCRIPTION ${DESC} GROUP ${GROUP})
+    cpack_add_component(${COMPONENTNAME} DESCRIPTION ${DESC} GROUP ${GROUP})
 endfunction()
 
 # Adds a boost test executable to CTest.  These executable will be run
 # with 'make test' @param EXE - boost test executable.  Probably built
 # using asterisk_scf_component_build_standalone.
 function(boost_add_test EXE)
-  add_test(NAME ${EXE} COMMAND ${EXE}
-    --report_sink=${CMAKE_BINARY_DIR}/${EXE}-result.xml
-    --report_format=XML --report_level=detailed)
+    add_test(NAME ${EXE} COMMAND ${EXE}
+        --report_sink=${CMAKE_BINARY_DIR}/${EXE}-result.xml
+        --report_format=XML --report_level=detailed)
 endfunction()
 
 function(icebox_add_test NAME CONFIG)
-  add_test(NAME ${NAME} COMMAND ${ICEBOX} --Ice.Config=${CONFIG})
+    add_test(NAME ${NAME} COMMAND ${ICEBOX} --Ice.Config=${CONFIG})
 endfunction()

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


-- 
asterisk-scf/release/cmake.git



More information about the asterisk-scf-commits mailing list