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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Jan 17 15:30:18 CST 2011


branch "ice-package" has been updated
       via  577cfc3d97ca02e8c46c91a144b0c1bb14ddb786 (commit)
       via  0e015db028ac1d9f72e9e8c54331a22a2bc99f38 (commit)
       via  787eba376cf49b90159955863421080929f9f903 (commit)
       via  419edd281ed4e2cf7fec527d6950edc1d7d512fa (commit)
       via  e5b3aebd2f8feb16bfcf4a8984cf7dea543e8496 (commit)
       via  24c4357778cdb9591d003130319ef028367c8c31 (commit)
      from  36f69e1f861d6d3ebe5fd7a873f1bf21a219db32 (commit)

Summary of changes:
 AsteriskSCF.cmake      | 1041 +++++++++++++++++++-----------------------------
 example/CMakeLists.txt |   21 +-
 init-cmake.sh          |   22 +-
 modules/FindIce.cmake  |   43 +-
 4 files changed, 461 insertions(+), 666 deletions(-)


- Log -----------------------------------------------------------------
commit 577cfc3d97ca02e8c46c91a144b0c1bb14ddb786
Merge: 36f69e1 0e015db
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Mon Jan 17 15:29:42 2011 -0600

    Merge branch 'master' into ice-package, and make AsteriskSCF.cmake
    actually work using FindIce.cmake

diff --cc AsteriskSCF.cmake
index 25772d7,06d201b..55f5ef8
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@@ -52,82 -52,142 +52,86 @@@ 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()
  
- # 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()
- 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")
+ set(INSTALL_BIN_DIR bin CACHE FILEPATH
+     "executable programs that users can run")
+ set(INSTALL_LIB_DIR lib CACHE FILEPATH
+     "object files and libraries of object code")
+ set(INSTALL_DATA_ROOT_DIR share CACHE FILEPATH
+     "read-only architecture-independent data files")
+ set(INSTALL_DATA_DIR ${INSTALL_DATA_ROOT_DIR} CACHE FILEPATH
+     "idiosyncratic read-only architecture-independent data files for this program")
+ set(INSTALL_INCLUDE_DIR include CACHE FILEPATH
+     "directory for installing header files")
+ set(INSTALL_LOCAL_STATE_DIR var CACHE FILEPATH
+     "data files which the programs modify while they run, and that pertain to one specific machine")
+ 
 -set(ASTERISK_SCF_INSTALL_CONF_DIR ${INSTALL_SYS_CONF_DIR}/asterisk-scf
 -    CACHE FILEPATH "AsteriskSCF files")
 -set(ASTERISK_SCF_INSTALL_BIN_DIR ${INSTALL_BIN_DIR} CACHE FILEPATH
 -    "AsteriskSCF executable programs")
 -set(ASTERISK_SCF_INSTALL_LIB_DIR ${INSTALL_LIB_DIR} CACHE FILEPATH
 -    "AsteriskSCF libraries")
 -set(ASTERISK_SCF_INSTALL_ICEBOX_DIR ${INSTALL_LIB_DIR}/asterisk-scf/icebox
 -    CACHE FILEPATH "AsteriskSCF Icebox modules")
++set(ASTERISK_SCF_INSTALL_CONF_DIR
++    ${INSTALL_SYS_CONF_DIR}/asterisk-scf CACHE FILEPATH
++    "Asterisk SCF files")
++set(ASTERISK_SCF_INSTALL_BIN_DIR
++    ${INSTALL_BIN_DIR} CACHE FILEPATH
++    "Asterisk SCF executable programs")
++set(ASTERISK_SCF_INSTALL_LIB_DIR
++    ${INSTALL_LIB_DIR} CACHE FILEPATH
++    "Asterisk SCF libraries")
++set(ASTERISK_SCF_INSTALL_ICEBOX_DIR
++    ${INSTALL_LIB_DIR}/asterisk-scf/icebox
++    CACHE FILEPATH
++    "Asterisk SCF IceBox modules")
+ set(ASTERISK_SCF_INSTALL_LOCAL_STATE_DIR
+     ${INSTALL_LOCAL_STATE_DIR}/lib/asterisk-scf CACHE FILEPATH
 -    "AsteriskSCF local state files")
 -set(ASTERISK_SCF_INSTALL_LOG_FILE ${INSTALL_LOCAL_STATE_DIR}/log/asterisk-scf.log
 -    CACHE FILEPATH "AsteriskSCF logfile")
 -set(ASTERISK_SCF_INSTALL_INCLUDE_DIR ${INSTALL_INCLUDE_DIR} CACHE FILEPATH
 -    "AsteriskSCF directory for installing include files")
 -set(ASTERISK_SCF_INSTALL_SLICE_DIR ${INSTALL_DATA_DIR}/asterisk-scf/slice
 -    CACHE FILEPATH "AsteriskSCF directory for installing slice files")
++    "Asterisk SCF local state files")
++set(ASTERISK_SCF_INSTALL_LOG_FILE
++    ${INSTALL_LOCAL_STATE_DIR}/log/asterisk-scf.log CACHE FILEPATH
++    "Asterisk SCF logfile")
++set(ASTERISK_SCF_INSTALL_INCLUDE_DIR
++    ${INSTALL_INCLUDE_DIR} CACHE FILEPATH
++    "Directory for installed Asterisk SCF API C++ header files")
++set(ASTERISK_SCF_INSTALL_SLICE_DIR
++    ${INSTALL_DATA_DIR}/asterisk-scf/slice CACHE FILEPATH
++    "Directory for installed Asterisk SCF API Slice files")
+ 
+ mark_as_advanced(
 -    INSTALL_SYS_CONF_DIR
 -    INSTALL_BIN_DIR
 -    INSTALL_LIB_DIR
 -    INSTALL_DATA_ROOT_DIR
 -    INSTALL_DATA_DIR
 -    INSTALL_INCLUDE_DIR
 -    INSTALL_LOCAL_STATE_DIR
+     ASTERISK_SCF_INSTALL_CONF_DIR
+     ASTERISK_SCF_INSTALL_BIN_DIR
+     ASTERISK_SCF_INSTALL_LIB_DIR
+     ASTERISK_SCF_INSTALL_ICEBOX_DIR
+     ASTERISK_SCF_INSTALL_LOCAL_STATE_DIR
+     ASTERISK_SCF_INSTALL_LOG_FILE
+     ASTERISK_SCF_INSTALL_INCLUDE_DIR
+     ASTERISK_SCF_INSTALL_SLICE_DIR)
  
 -# 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()
 -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
  # for consistency
  string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
  
--# threading support required
--find_package(Threads REQUIRED)
--
--if(CMAKE_SYSTEM MATCHES "SunOS.*")
-   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)
- 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)
- endif()
- 
 -    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)
 -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)
 -endif()
 -
  if(WIN32 AND ${CMAKE_BUILD_TYPE} STREQUAL profile)
-   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)
+     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)
 -endif()
 -
  if(${CMAKE_BUILD_TYPE} STREQUAL profile)
-   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 "Disabling shared libs.")
+     set(BUILD_SHARED_LIBS false
+         CACHE BOOL "Enables building shared libraries." FORCE)
 -endif()
 -
 -if(NOT DEFINED BUILD_SHARED_LIBS)
++elseif(NOT DEFINED BUILD_SHARED_LIBS)
+     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
@@@ -141,130 -201,207 +145,152 @@@ elseif(UNIX AND EXISTS "${CMAKE_SOURCE_
  endif()
  
  macro(set_cache_var)
-   set(${ARGV} CACHE INTERNAL Bob FORCE)
+     set(${ARGV} CACHE INTERNAL Bob FORCE)
  endmacro()
  
- # Find an Ice library.
- function(find_ICE_library LIBRARY)
-   if(NOT ICE_LIB_${LIBRARY})
 -# Function which scans a path for matching files or directories,
 -# whose names end with a standard version number string, and
 -# returns the one with the 'highest' version found, or NOTFOUND
 -# 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)
++# Function which initializes project specific things
++function(asterisk_scf_project NAME ICE_VERSION)
++    message(STATUS "Setting up project ${NAME} for Ice version ${ICE_VERSION}")
++    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)
-       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()
++        message(STATUS "Setting ASTERISK_SCF_ICEBOX_EXPORT definition for Windows IceBox services")
++        add_definitions(-DASTERISK_SCF_ICEBOX_EXPORT=__declspec\(dllexport\))
+     else()
 -        set(${output} "NOTFOUND" PARENT_SCOPE)
++        add_definitions(-DASTERISK_SCF_ICEBOX_EXPORT=)
      endif()
-   endif()
 -endfunction()
++    # 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()
++    message(STATUS "Performing requirement checks for components")
++    find_package(Ice 3.4 REQUIRED Ice IceUtil)
++    # All components need the Ice library, and it needs the
++    # IceUtil library (as do most components), so link
++    # every component against those libraries at minimum
++    set(ASTERISK_SCF_ICE_LIBRARIES ICE ICEUTIL PARENT_SCOPE)
++    message(STATUS "Using Ice C++ headers from: ${ICE_INCLUDE_DIR}")
++    include_directories("${ICE_INCLUDE_DIR}")
+ 
 -# 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}")
++    # threading support required
++    find_package(Threads REQUIRED)
++    if(CMAKE_THREAD_LIBS_INIT)
++        if(NOT CMAKE_HAVE_THREADS_LIBRARY)
++            list(APPEND cxx_flags "${CMAKE_THREAD_LIBS_INIT}")
++        else()
++	    list(APPEND linker_flags "${CMAKE_THREAD_LIBS_INIT}")
+         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)")
++    # 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")
++	    list(APPEND cxx_flags "-std=c++0x")
++        else()
++            message(STATUS "Support for C++0x Disabled")
++        endif()
+     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")
++    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_PROFILE
++            "${CMAKE_C_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs"
++            CACHE STRING "Flags used by the compiler during profile builds." FORCE)
++        mark_as_advanced(CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_PROFILE)
+     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()
++        set(CMAKE_CXX_FLAGS "${ICE_CXX_FLAGS} ${cxx_flags}"
++            CACHE STRING "Flags used by the compiler during all 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_PROFILE
++            "${CMAKE_CXX_FLAGS_DEBUG} -ftest-coverage -fprofile-arcs"
++            CACHE STRING "Flags used by the compiler during profile builds." FORCE)
++        mark_as_advanced(CMAKE_C_FLAGS_PROFILE CMAKE_CXX_FLAGS_PROFILE CMAKE_EXE_LINKER_FLAGS_PROFILE)
++    endif()
++
++    set(CMAKE_EXE_LINKER_FLAGS "${linker_flags}"
++        CACHE STRING "Flags used by the linker for standalone components during all builds." FORCE)
++    set(CMAKE_MODULE_LINKER_FLAGS "${linker_flags}"
++        CACHE STRING "Flags used by the linker for modules during all builds." FORCE)
++    set(CMAKE_SHARED_LINKER_FLAGS "${linker_flags}"
++        CACHE STRING "Flags used by the linker for shared libraries during all builds." FORCE)
  
-   if(UNIX)
-     get_filename_component(library_path ${ICE_LIB_${LIBRARY}} PATH)
-     link_directories(${library_path})
-   endif()
 -# 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()
++    message(STATUS "Passed requirement checks for CXX components")
++endfunction()
+ 
 -    if(UNIX)
 -        get_filename_component(library_path ${ICE_LIB_${LIBRARY}} PATH)
 -        link_directories(${library_path})
 -    endif()
++# 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()
  
  # 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")
+         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()
-     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})
+     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()
++        find_package(Boost REQUIRED ${LIBRARY})
      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}")
-   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_package(Ice 3.4 REQUIRED)
-   message(FATAL_ERROR "stopping")
-   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)
  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")
 -endfunction()
 -
 -# Function which adds Ice libraries to all components in the current
 +# Function which adds Boost libraries to all components in the current
  # directory and below
 -function(asterisk_scf_add_ice_libraries)
 +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_ICE_LIBRARIES})
++    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_ICE_library(${lib})
++        find_Boost_library(${lib})
++	string(TOUPPER "${lib}" lib)
+         list(APPEND libs ${lib})
+     endforeach()
+     list(REMOVE_DUPLICATES libs)
 -    set(ASTERISK_SCF_ICE_LIBRARIES ${libs} PARENT_SCOPE)
++    set(ASTERISK_SCF_BOOST_LIBRARIES ${libs} PARENT_SCOPE)
++    include_directories(${Boost_INCLUDE_DIR})
++    link_directories(${Boost_LIBRARY_DIRS})
+ endfunction()
+ 
 -# Function which adds Boost libraries to all components in the current
 -# directory and below
 -function(asterisk_scf_add_boost_libraries)
++# 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 ${ASTERISK_SCF_BOOST_LIBRARIES})
++    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})
++	string(TOUPPER "${lib}" lib)
+         list(APPEND libs ${lib})
+     endforeach()
+     list(REMOVE_DUPLICATES libs)
 -    set(ASTERISK_SCF_BOOST_LIBRARIES ${libs} PARENT_SCOPE)
++    set(${COMPONENT}_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.
@@@ -297,455 -428,297 +317,234 @@@ 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})
++        find_package(Ice REQUIRED ${lib})
++	string(TOUPPER "${lib}" 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 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 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)
  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()
 -# Function which adds Ice libraries needed by a component
 -function(asterisk_scf_component_add_ice_libraries COMPONENT)
++# 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 ${${COMPONENT}_ICE_LIBRARIES})
++    set(libs ${ASTERISK_SCF_ICE_LIBRARIES})
+     foreach(lib ${ARGN})
 -        find_ICE_library(${lib})
++        find_package(Ice REQUIRED ${lib})
++	string(TOUPPER "${lib}" lib)
+         list(APPEND libs ${lib})
      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()
+     list(REMOVE_DUPLICATES libs)
 -    set(${COMPONENT}_ICE_LIBRARIES ${libs} PARENT_SCOPE)
++    set(ASTERISK_SCF_ICE_LIBRARIES ${libs} PARENT_SCOPE)
+ endfunction()
+ 
 -# Function which adds Boost libraries needed by a component
 -function(asterisk_scf_component_add_boost_libraries COMPONENT)
++# 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}_BOOST_LIBRARIES})
 -    # By default we are disabling boost auto-linking and specifying dynamic linking.
 -    add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_ALL_DYN_LINK)
++    set(libs ${${COMPONENT}_ICE_LIBRARIES})
+     foreach(lib ${ARGN})
 -        find_Boost_library(${lib})
++        find_package(Ice REQUIRED ${lib})
++	string(TOUPPER "${lib}" lib)
+         list(APPEND libs ${lib})
      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}")
+     list(REMOVE_DUPLICATES libs)
 -    set(${COMPONENT}_BOOST_LIBRARIES ${libs} PARENT_SCOPE)
 -    include_directories(${Boost_INCLUDE_DIR})
 -    link_directories(${Boost_LIBRARY_DIRS})
++    set(${COMPONENT}_ICE_LIBRARIES ${libs} PARENT_SCOPE)
+ 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}")
++	    mark_as_advanced(SLICE_COMPILER)
+         else()
+             message(FATAL_ERROR "Failed to find Slice compiler")
+         endif()
      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")
+ 
+     # 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()
-   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()
+     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()
-   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()
+     message(STATUS "Adding ${SLICE} to ${COMPONENT}")
+     # get subdirectory slice is in
+     get_filename_component(slice_subdir "${SLICE}" PATH)
  
- # 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()
+     # 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()
  
- # 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")
+     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()
-     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)
- endfunction()
+     # 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()
  
- # 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)
+     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 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})
 -# 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})
++# Function which collects libraries needed by a component
++function(asterisk_scf_component_libraries COMPONENT)
++    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()
++        list(APPEND target_libs "${ICE_${lib}_LIBRARY}")
+     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}")
++            list(APPEND target_libs "${Boost_${lib}_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})
++    set(component_libs ${target_libs} 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")
-   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}")
-     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})
++    message(STATUS "Building component ${COMPONENT} as an IceBox service")
++    find_package(Ice REQUIRED IceBox)
++    list(APPEND icelibs ${${COMPONENT}_ICE_LIBRARIES} ICEBOX)
++    asterisk_scf_component_libraries(${COMPONENT})
++
++    # 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
++    target_link_libraries(${COMPONENT} ${component_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}")
-     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})
+     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()
++    asterisk_scf_component_libraries(${COMPONENT})
+ 
+     # 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})
++    # Link required libraries
++    target_link_libraries(${COMPONENT} ${component_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}")
-     endforeach()
-   endif()
-   target_link_libraries(${COMPONENT} ${${COMPONENT}_SLICES} ${target_libs})
+     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()
++    asterisk_scf_component_libraries(${COMPONENT})
+ 
+     # 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})
++    # Link required libraries
++    target_link_libraries(${COMPONENT} ${component_libs})
  endfunction()
  
  # Function which adds information for installing a component
diff --cc modules/FindIce.cmake
index f4d64ef,0000000..a28b7ff
mode 100644,000000..100644
--- a/modules/FindIce.cmake
+++ b/modules/FindIce.cmake
@@@ -1,228 -1,0 +1,227 @@@
 +#
 +# sets:
 +# ICE_FOUND
 +# ICE_DIR
 +# ICE_INCLUDE_DIR
 +# ICE_SLICE_DIR
 +# ICE_CXX_FLAGS
 +# ICE_VERSION
 +# ICE_VERSION_MAJOR
 +# ICE_VERSION_MINOR
 +# ICE_VERSION_PATCH
 +# for each component requested, sets (with <component> uppercased):
 +# ICE_<component>_FOUND
 +# ICE_<component>_LIBRARY
 +# ICE_<component>_LIBRARY_DEBUG
 +# ICE_<component>_LIBRARY_RELEASE
- # ICE_<component>_LIBRARIES
 +
 +find_package(PackageHandleStandardArgs)
 +find_package(PackageComponentHandleStandardArgs)
 +
 +function(_ice_set_cache_path var value reason)
-   set(${var} ${value} CACHE PATH "${reason}" FORCE)
-   mark_as_advanced(FORCE ${var})
++  set("${var}" "${value}" CACHE PATH "${reason}" FORCE)
++  mark_as_advanced(FORCE "${var}")
 +endfunction()
 +
 +function(_ice_set_cache_filepath var value reason)
-   set(${var} ${value} CACHE FILEPATH "${reason}" FORCE)
-   mark_as_advanced(FORCE ${var})
++  set("${var}" "${value}" CACHE FILEPATH "${reason}" FORCE)
++  mark_as_advanced(FORCE "${var}")
 +endfunction()
 +
 +function(_ice_set_cache_string var value reason)
-   set(${var} ${value} CACHE STRING "${reason}" FORCE)
-   mark_as_advanced(FORCE ${var})
++  set("${var}" "${value}" CACHE STRING "${reason}" FORCE)
++  mark_as_advanced(FORCE "${var}")
 +endfunction()
 +
 +function(_ice_find_library library)
 +  string(TOUPPER "${library}" upper)
 +
-   if(WIN32)
-     set(_ice_debug_suffix "d")
-   endif()
++  set(_ice_debug_suffix "${CMAKE_DEBUG_POSTFIX}")
 +
 +  find_library(ICE_${upper}_LIBRARY_RELEASE NAMES "${library}" NO_DEFAULT_PATH PATHS "${ICE_DIR}" PATH_SUFFIXES "lib" "lib32" "lib64")
 +  find_library(ICE_${upper}_LIBRARY_DEBUG NAMES "${library}${_ice_debug_suffix}" NO_DEFAULT_PATH PATHS "${ICE_DIR}" PATH_SUFFIXES "lib" "lib32" "lib64")
 +  
++  mark_as_advanced(ICE_${upper}_LIBRARY_RELEASE ICE_${upper}_LIBRARY_DEBUG)
++
 +  if(ICE_${upper}_LIBRARY_DEBUG OR ICE_${upper}_LIBRARY_RELEASE)
 +    _ice_set_cache_string(ICE_${upper}_FOUND ON "The Ice ${library} library was found")
 +  endif()
 +
 +  if(Ice_DEBUG)
 +    message(STATUS
 +      "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
 +      "${library} library (release) found at ${ICE_${upper}_LIBRARY_RELEASE} "
 +      "${library} library (debug) found at ${ICE_${upper}_LIBRARY_DEBUG} ")
 +  endif()
 +endfunction()
 +
 +# Lifted (and then modified) from FindBoost.cmake, which got it from FindQt4.cmake.
 +function(_ice_adjust_lib_vars library)
 +  string(TOUPPER "${library}" upper)
 +  if(ICE_${upper}_LIBRARY_DEBUG AND ICE_${upper}_LIBRARY_RELEASE)
 +    # if the generator supports configuration types then set
 +    # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
 +    if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
-       set(ICE_${upper}_LIBRARY optimized ${ICE_${upper}_LIBRARY_RELEASE} debug ${ICE_${upper}_LIBRARY_DEBUG})
++      set(ICE_${upper}_LIBRARY optimized "${ICE_${upper}_LIBRARY_RELEASE}" debug "${ICE_${upper}_LIBRARY_DEBUG}")
 +    else()
 +      # if there are no configuration types and CMAKE_BUILD_TYPE has no value
 +      # then just use the release libraries
-       set(ICE_${upper}_LIBRARY ${ICE_${upper}_LIBRARY_RELEASE})
++      set(ICE_${upper}_LIBRARY "${ICE_${upper}_LIBRARY_RELEASE}")
 +    endif()
 +  endif()
 +
 +  # if only the release version was found, set the debug variable also to the release version
 +  if(ICE_${upper}_LIBRARY_RELEASE AND NOT ICE_${upper}_LIBRARY_DEBUG)
-     _ice_set_cache_filepath(ICE_${upper}_LIBRARY_DEBUG ${ICE_${upper}_LIBRARY_RELEASE} "Path to a library.")
-     set(ICE_${upper}_LIBRARY       ${ICE_${upper}_LIBRARY_RELEASE})
++    _ice_set_cache_filepath(ICE_${upper}_LIBRARY_DEBUG "${ICE_${upper}_LIBRARY_RELEASE}" "Path to a library.")
++    set(ICE_${upper}_LIBRARY "${ICE_${upper}_LIBRARY_RELEASE}")
 +  endif()
 +
 +  # if only the debug version was found, set the release variable also to the debug version
 +  if(ICE_${upper}_LIBRARY_DEBUG AND NOT ICE_${upper}_LIBRARY_RELEASE)
-     _ice_set_cache_filepath(ICE_${upper}_LIBRARY_RELEASE ${ICE_${upper}_LIBRARY_DEBUG} "Path to a library.")
-     set(ICE_${upper}_LIBRARY         ${ICE_${upper}_LIBRARY_DEBUG})
++    _ice_set_cache_filepath(ICE_${upper}_LIBRARY_RELEASE "${ICE_${upper}_LIBRARY_DEBUG}" "Path to a library.")
++    set(ICE_${upper}_LIBRARY "${ICE_${upper}_LIBRARY_DEBUG}")
 +  endif()
 +  
 +  if(ICE_${upper}_LIBRARY)
-     _ice_set_cache_string(ICE_${upper}_LIBRARY ${ICE_${upper}_LIBRARY} "The Ice ${library} library")
++    _ice_set_cache_string(ICE_${upper}_LIBRARY "${ICE_${upper}_LIBRARY}" "The Ice ${library} library")
 +  endif()
 +endfunction()
 +
 +if(NOT ICE_DIR)
 +  if(NOT Ice_FIND_VERSION)
 +    find_package_handle_standard_args(Ice "Major and minor version numbers (at least) must be supplied to find Ice." ICE_DIR)
 +  endif()
 +
 +  if($ENV{ICE_HOME})
 +    # if ICE_HOME is set, we will only look there; if the version present there
 +    # does not satisfy the requested version, then the search will fail
 +    list(APPEND _ice_candidate_dirs "$ENV{ICE_HOME}")
 +  else()
 +    if(Ice_FIND_VERSION_EXACT)
 +      # we prefer to find an Ice directory without a patch version specified if possible, so put
 +      # that in the list first
 +      list(APPEND _ice_candidate_versions
 +	"${Ice_FIND_VERSION_MAJOR}.${Ice_FIND_VERSION_MINOR}"
 +	"${Ice_FIND_VERSION_MAJOR}.${Ice_FIND_VERSION_MINOR}.${Ice_FIND_VERSION_PATCH}")
 +    else()
 +      # we prefer to find an Ice directory without a patch version specified if possible, so put
 +      # that in the list first
 +      list(APPEND _ice_candidate_versions
 +	"${Ice_FIND_VERSION_MAJOR}.${Ice_FIND_VERSION_MINOR}")
 +
 +      # next, search for any patch version greater-than or equal-to what was requested
 +      foreach(patch RANGE 10 0 -1)
 +	if(NOT "${Ice_FIND_VERSION_MAJOR}.${Ice_FIND_VERSION_MINOR}.${patch}" VERSION_LESS "${Ice_FIND_VERSION}")
 +	  list(APPEND _ice_candidate_versions
 +	    "${Ice_FIND_VERSION_MAJOR}.${Ice_FIND_VERSION_MINOR}.${patch}")
 +	endif()
 +      endforeach()
 +
 +    endif()
 +
 +    # now convert each candidate version into a directory path
 +    foreach(version IN LISTS _ice_candidate_versions)
 +      if(WIN32)
 +	list(APPEND _ice_candidate_dirs "C:/Ice-${version}")
 +      elseif(UNIX)
 +	list(APPEND _ice_candidate_dirs "/opt/Ice-${version}")
 +      endif()
 +    endforeach()
 +
 +  endif()
 +
 +  if(Ice_DEBUG)
 +    message(STATUS
 +      "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
 +      "will search for Ice in these directories: ${_ice_candidate_dirs}")
 +  endif()
 +
 +  # since we may find a copy of Ice with a directory name that matches one of our candidates
 +  # but does not provide an adequate version, we have to be prepared to search repeatedly
 +  # until either an adequate version is found or all the candidates are exhausted
 +  while(NOT ICE_DIR)
 +    find_path(ICE_INCLUDE_DIR NAMES "IceUtil/Config.h" PATHS ${_ice_candidate_dirs} PATH_SUFFIXES "include" NO_DEFAULT_PATH)
 +
 +    # if nothing was found, then stop now
 +    if(NOT ICE_INCLUDE_DIR)
 +      break()
 +    endif()
 +
 +    if(Ice_DEBUG)
 +      message(STATUS
 +	"[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
 +        "found Ice includes at: ${ICE_INCLUDE_DIR}")
 +    endif()
 +
 +    get_filename_component(_ice_possible_dir "${ICE_INCLUDE_DIR}" PATH)
 +
 +    # now check the embedded version in the IceUtil/Config.h file to ensure it
 +    # satisfies the version requested
 +    file(READ "${ICE_INCLUDE_DIR}/IceUtil/Config.h" _ice_config_contents)
 +    string(REGEX REPLACE ".*#define.*ICE_STRING_VERSION.*\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" "\\1" _ice_config_version "${_ice_config_contents}")
 +
 +    if(Ice_DEBUG)
 +      message(STATUS
 +	"[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
 +        "Ice version detected: ${_ice_config_version}")
 +    endif()
 +
 +    if((NOT Ice_FIND_VERSION_EXACT) OR (${_ice_config_version} VERSION_EQUAL ${Ice_FIND_VERSION}))
 +      _ice_set_cache_path(ICE_DIR "${_ice_possible_dir}" "Location of Ice")
 +      _ice_set_cache_string(ICE_VERSION "${_ice_config_version}" "Version of Ice")
 +      string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" _ice_version_major "${_ice_config_version}")
 +      _ice_set_cache_string(ICE_VERSION_MAJOR "${_ice_version_major}" "Version of Ice (major)")
 +      string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" _ice_version_minor "${_ice_config_version}")
 +      _ice_set_cache_string(ICE_VERSION_MINOR "${_ice_version_minor}" "Version of Ice (minor)")
 +      string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" _ice_version_patch "${_ice_config_version}")
 +      _ice_set_cache_string(ICE_VERSION_PATCH "${_ice_version_patch}" "Version of Ice (patch)")
 +      break()
 +    endif()
 +
 +    if(Ice_DEBUG)
 +      message(STATUS
 +	"[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
 +	"Ice version ${_ice_config_version} does not match requested ${Ice_FIND_VERSION}")
 +    endif()
 +
 +    # we are in EXACT find mode, and the version in the directory found
 +    # does not satisfy the requested version... so remove this directory
 +    # as a candidate and try again
-     list(REMOVE_ITEM _ice_candidate_dirs ${_ice_possible_dir})
++    list(REMOVE_ITEM _ice_candidate_dirs "${_ice_possible_dir}")
 +    unset(ICE_INCLUDE_DIR CACHE)
 +  endwhile()
 +
 +  if(ICE_DIR)
 +    mark_as_advanced(FORCE ICE_INCLUDE_DIR)
 +    
 +    find_path(ICE_SLICE_DIR "Ice/Current.ice" PATHS "${ICE_DIR}" PATH_SUFFIXES "slice" NO_DEFAULT_PATH)
 +    if(NOT ICE_SLICE_DIR)
 +      message(WARNING "Ice installation located at ${ICE_DIR} is incomplete or broken (missing 'slice' directory)")
 +    else()
 +      mark_as_advanced(FORCE ICE_SLICE_DIR)
 +    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 being utilized so that Ice itself does not have to be updated to be C++0x safe.
 +    if(CMAKE_COMPILER_IS_GNUCXX)
 +      _ice_set_cache_string(ICE_CXX_FLAGS "-isystem ${ICE_INCLUDE_DIR}" "Ice-specific compiler flags")
 +    endif()
 +
 +  endif()
 +
 +  find_package_handle_standard_args(Ice DEFAULT_MSG ICE_DIR ICE_SLICE_DIR ICE_INCLUDE_DIR)
 +endif()
 +
 +if(ICE_DIR)
 +  foreach(component IN LISTS Ice_FIND_COMPONENTS)
 +    string(TOUPPER "${component}" upper)
 +    if(NOT ICE_${upper}_FOUND)
 +      _ice_find_library("${component}")
++      if(ICE_${upper}_FOUND)
++	_ice_adjust_lib_vars("${component}")
++      endif()
++      find_package_component_handle_standard_args(Ice "${component}" DEFAULT_MSG ICE_${upper}_LIBRARY)
 +    endif()
-     if(ICE_${upper}_FOUND)
-       _ice_adjust_lib_vars("${component}")
-     endif()
-     find_package_component_handle_standard_args(Ice "${component}" DEFAULT_MSG ICE_${upper}_LIBRARY)
 +  endforeach()
 +endif()

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


-- 
asterisk-scf/release/cmake.git



More information about the asterisk-scf-commits mailing list