[Freeswitch-svn] [commit] r11744 - freeswitch/trunk/cmake_modules

FreeSWITCH SVN shaneb at freeswitch.org
Tue Feb 10 18:53:31 PST 2009


Author: shaneb
Date: Tue Feb 10 20:53:31 2009
New Revision: 11744

Log:
Initial CMAKE file commit

Added:
   freeswitch/trunk/cmake_modules/
   freeswitch/trunk/cmake_modules/FindAPR.cmake
   freeswitch/trunk/cmake_modules/FindAPRUtil.cmake
   freeswitch/trunk/cmake_modules/FindLibedit.cmake
   freeswitch/trunk/cmake_modules/FindSndfile.cmake

Added: freeswitch/trunk/cmake_modules/FindAPR.cmake
==============================================================================
--- (empty file)
+++ freeswitch/trunk/cmake_modules/FindAPR.cmake	Tue Feb 10 20:53:31 2009
@@ -0,0 +1,51 @@
+# Locate APR include paths and libraries
+
+# This module defines
+# APR_INCLUDES, where to find apr.h, etc.
+# APR_LIBS, the libraries to link against to use APR.
+# APR_FLAGS, the flags to use to compile
+# APR_DEFINITIONS, definitions to use when compiling code that uses APR.
+# APR_FOUND, set to 'yes' if found
+
+find_program(APR_CONFIG_EXECUTABLE
+    apr-1-config
+    /usr/local/apr/1.2.12/bin
+    /usr/local/bin
+    /usr/bin
+    C:/Progra~1/apr/bin
+    )
+
+mark_as_advanced(APR_CONFIG_EXECUTABLE)
+
+macro(_apr_invoke _varname _regexp)
+    execute_process(
+        COMMAND ${APR_CONFIG_EXECUTABLE} ${ARGN}
+        OUTPUT_VARIABLE _apr_output
+        RESULT_VARIABLE _apr_failed
+    )
+
+    if(_apr_failed)
+        message(FATAL_ERROR "apr-1-config ${ARGN} failed")
+    else(_apr_failed)
+        string(REGEX REPLACE "[\r\n]"  "" _apr_output "${_apr_output}")
+        string(REGEX REPLACE " +$"     "" _apr_output "${_apr_output}")
+
+        if(NOT ${_regexp} STREQUAL "")
+            string(REGEX REPLACE "${_regexp}" " " _apr_output "${_apr_output}")
+        endif(NOT ${_regexp} STREQUAL "")
+
+        separate_arguments(_apr_output)
+        set(${_varname} "${_apr_output}")
+    endif(_apr_failed)
+endmacro(_apr_invoke)
+
+_apr_invoke(APR_INCLUDES  "(^| )-I" --includes)
+_apr_invoke(APR_FLAGS               --cppflags --cflags)
+_apr_invoke(APR_EXTRALIBS "(^| )-l" --libs)
+_apr_invoke(APR_LIBS      ""        --link-ld)
+
+if(APR_INCLUDES AND APR_EXTRALIBS AND APR_LIBS)
+    set(APR_FOUND "YES")
+    message (STATUS "apr found: YES ${APR_LIBS}")
+endif(APR_INCLUDES AND APR_EXTRALIBS AND APR_LIBS)
+

Added: freeswitch/trunk/cmake_modules/FindAPRUtil.cmake
==============================================================================
--- (empty file)
+++ freeswitch/trunk/cmake_modules/FindAPRUtil.cmake	Tue Feb 10 20:53:31 2009
@@ -0,0 +1,49 @@
+# Locate APR-Util include paths and libraries
+
+# This module defines
+# APRUTIL_INCLUDES, where to find apr.h, etc.
+# APRUTIL_LIBS, the libraries to link against to use APR.
+# APRUTIL_FOUND, set to yes if found
+
+find_program(APRUTIL_CONFIG_EXECUTABLE
+    apu-1-config
+    /usr/local/apr-util/1.2.12/bin
+    /usr/local/bin
+    /usr/bin
+    C:/Progra~1/apr/bin
+    )
+
+mark_as_advanced(APRUTIL_CONFIG_EXECUTABLE)
+
+macro(_apu_invoke _varname _regexp)
+    execute_process(
+        COMMAND ${APRUTIL_CONFIG_EXECUTABLE} ${ARGN}
+        OUTPUT_VARIABLE _apr_output
+        RESULT_VARIABLE _apr_failed
+    )
+
+    if(_apr_failed)
+        message(FATAL_ERROR "apu-1-config ${ARGN} failed")
+    else(_apr_failed)
+        string(REGEX REPLACE "[\r\n]"  "" _apr_output "${_apr_output}")
+        string(REGEX REPLACE " +$"     "" _apr_output "${_apr_output}")
+
+        if(NOT ${_regexp} STREQUAL "")
+            string(REGEX REPLACE "${_regexp}" " " _apr_output "${_apr_output}")
+        endif(NOT ${_regexp} STREQUAL "")
+
+        separate_arguments(_apr_output)
+
+        set(${_varname} "${_apr_output}")
+    endif(_apr_failed)
+endmacro(_apu_invoke)
+
+_apu_invoke(APRUTIL_INCLUDES "(^| )-I"  --includes)
+_apu_invoke(APRUTIL_LIBS     ""         --link-ld)
+
+if(APRUTIL_LIBS AND APRUTIL_INCLUDES)
+    set(APRUTIL_FOUND "YES")
+    set(APRUTIL_DEFINITIONS "")
+    message (STATUS "apr-util found: YES ${APRUTIL_LIBS}")
+endif(APRUTIL_LIBS AND APRUTIL_INCLUDES)
+

Added: freeswitch/trunk/cmake_modules/FindLibedit.cmake
==============================================================================
--- (empty file)
+++ freeswitch/trunk/cmake_modules/FindLibedit.cmake	Tue Feb 10 20:53:31 2009
@@ -0,0 +1,15 @@
+ 
+find_path(PATH_INC_EDIT NAMES "histedit.h" PATHS ${CMAKE_SOURCE_DIR}/libs/libedit/src/)
+
+if( NOT PATH_INC_EDIT )
+        message(FATAL_ERROR"Unable to locate libedit include files" )
+endif( NOT PATH_INC_EDIT )
+
+find_library(PATH_LIB_EDIT NAMES "libedit.a" PATHS ${CMAKE_SOURCE_DIR}/libs/libedit/src/.libs/)
+
+if( NOT PATH_LIB_EDIT )
+        message(FATAL_ERROR "Unable to locate libedit library file" )
+endif( NOT PATH_LIB_EDIT )
+
+MESSAGE( STATUS "PATH_INC_EDIT = \"${PATH_INC_EDIT}\"" )
+MESSAGE( STATUS "PATH_LIB_EDIT = \"${PATH_LIB_EDIT}\"" )

Added: freeswitch/trunk/cmake_modules/FindSndfile.cmake
==============================================================================
--- (empty file)
+++ freeswitch/trunk/cmake_modules/FindSndfile.cmake	Tue Feb 10 20:53:31 2009
@@ -0,0 +1,34 @@
+# - Find sndfile
+# Find the native sndfile includes and libraries
+#
+#  SNDFILE_INCLUDE_DIR - where to find sndfile.h, etc.
+#  SNDFILE_LIBRARIES   - List of libraries when using libsndfile.
+#  SNDFILE_FOUND       - True if libsndfile found.
+
+if(SNDFILE_INCLUDE_DIR)
+    # Already in cache, be silent
+    set(SNDFILE_FIND_QUIETLY TRUE)
+endif(SNDFILE_INCLUDE_DIR)
+
+FIND_PATH(SNDFILE_INCLUDE_DIR NAMES sndfile.h PATHS ${CMAKE_SOURCE_DIR}/libs/libsndfile/src/)
+
+FIND_LIBRARY(SNDFILE_LIBRARY NAMES libsndfile.a PATHS ${CMAKE_SOURCE_DIR}/libs/libsndfile/src/.libs/)
+
+MESSAGE( STATUS "SNDFILE_INCLUDE_DIR = \"${SNDFILE_INCLUDE_DIR}\"" )
+MESSAGE( STATUS "SNDFILE_LIBRARY = \"${SNDFILE_LIBRARY}\"" )
+
+# Handle the QUIETLY and REQUIRED arguments and set SNDFILE_FOUND to TRUE if
+# all listed variables are TRUE.
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SNDFILE DEFAULT_MSG
+    SNDFILE_INCLUDE_DIR SNDFILE_LIBRARY)
+
+if(SNDFILE_FOUND)
+  set(SNDFILE_LIBRARIES ${SNDFILE_LIBRARY})
+else(SNDFILE_FOUND)
+  set(SNDFILE_LIBRARIES)
+endif(SNDFILE_FOUND)
+
+mark_as_advanced(SNDFILE_INCLUDE_DIR SNDFILE_LIBRARY)
+MESSAGE( STATUS "SNDFILE_INCLUDE_DIR = \"${SNDFILE_INCLUDE_DIR}\"" )
+MESSAGE( STATUS "SNDFILE_LIBRARY = \"${SNDFILE_LIBRARY}\"" )



More information about the Freeswitch-svn mailing list