Permalink
Browse files

Initial CMAKE file commit

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11744 d0543943-73ff-0310-b7d9-9358b9ac24b2
  • Loading branch information...
1 parent af4aa9b commit 3634615e2d7509a70df4ffd937d0b036ae444621 Shane Burrell committed Feb 11, 2009
Showing with 149 additions and 0 deletions.
  1. +51 −0 cmake_modules/FindAPR.cmake
  2. +49 −0 cmake_modules/FindAPRUtil.cmake
  3. +15 −0 cmake_modules/FindLibedit.cmake
  4. +34 −0 cmake_modules/FindSndfile.cmake
@@ -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)
+
@@ -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)
+
@@ -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}\"" )
@@ -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}\"" )

0 comments on commit 3634615

Please sign in to comment.