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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Jan 7 22:44:30 CST 2011


branch "ice-package" has been created
        at  66dfaaaf0d862e5884b295fb53b8bc468fb9773a (commit)

- Log -----------------------------------------------------------------
commit 66dfaaaf0d862e5884b295fb53b8bc468fb9773a
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Fri Jan 7 16:43:48 2011 -0600

    First pass: create a FindIce.cmake that can find Ice and set
    ICE_DIR, ICE_SLICE_DIR and ICE_INCLUDE_DIR. More to come, stay
    tuned!

diff --git a/AsteriskSCF.cmake b/AsteriskSCF.cmake
index e1d7330..25772d7 100644
--- a/AsteriskSCF.cmake
+++ b/AsteriskSCF.cmake
@@ -72,8 +72,6 @@ if(CMAKE_COMPILER_IS_GNUCXX)
   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
@@ -146,83 +144,6 @@ macro(set_cache_var)
   set(${ARGV} CACHE INTERNAL Bob FORCE)
 endmacro()
 
-# 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)
-  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()
-endfunction()
-
 # Find an Ice library.
 function(find_ICE_library LIBRARY)
   if(NOT ICE_LIB_${LIBRARY})
@@ -282,7 +203,6 @@ 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
@@ -297,7 +217,8 @@ function(asterisk_scf_project NAME ICE_VERSION)
   if(WIN32)
     set(CMAKE_DEBUG_POSTFIX "d" PARENT_SCOPE)
   endif()
-  find_ICE(${ICE_VERSION})
+  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)
diff --git a/modules/FindIce.cmake b/modules/FindIce.cmake
new file mode 100644
index 0000000..5a1588e
--- /dev/null
+++ b/modules/FindIce.cmake
@@ -0,0 +1,74 @@
+find_package(PackageHandleStandardArgs)
+
+# 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)
+  else()
+    set(${output} "NOTFOUND" PARENT_SCOPE)
+  endif()
+endfunction()
+
+macro(set_cache_var var value reason)
+  set(${var} ${value} CACHE INTERNAL "${reason}" FORCE)
+  mark_as_advanced(FORCE ${var})
+endmacro()
+
+set(ice "$ENV{ICE_HOME}")
+set(version "${Ice_FIND_VERSION}")
+if(NOT ice)
+  if(WIN32)
+    find_best_version(ice "C:/Ice-${version}")
+  elseif(UNIX)
+    find_best_version(ice "/opt/Ice-${version}")
+  endif()
+endif()
+
+if(ice)
+  file(TO_CMAKE_PATH "${ice}" ice_cmake_path)
+  set_cache_var(ICE_DIR "${ice_cmake_path}" "Location of Ice")
+
+  find_path(ICE_SLICE_DIR Ice/Current.ice PATHS "${ICE_DIR}/../slice" "${ICE_DIR}/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()
+
+  find_path(ICE_INCLUDE_DIR Ice/Ice.h PATHS "${ICE_DIR}/include" NO_DEFAULT_PATH)
+  if(NOT ICE_INCLUDE_DIR)
+    message(WARNING "Ice installation located at ${ICE_DIR} is incomplete or broken (missing headers)")
+  else()
+    mark_as_advanced(FORCE ICE_INCLUDE_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 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_cache_var(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)

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


-- 
asterisk-scf/release/cmake.git



More information about the asterisk-scf-commits mailing list