FindAPRUtil.cmake 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Locate APR-Util include paths and libraries
  2. # This module defines
  3. # APRUTIL_INCLUDES, where to find apr.h, etc.
  4. # APRUTIL_LIBS, the libraries to link against to use APR.
  5. # APRUTIL_FOUND, set to yes if found
  6. find_program(APRUTIL_CONFIG_EXECUTABLE
  7. apu-1-config
  8. /usr/local/apr-util/1.2.12/bin
  9. /usr/local/bin
  10. /usr/bin
  11. C:/Progra~1/apr/bin
  12. )
  13. mark_as_advanced(APRUTIL_CONFIG_EXECUTABLE)
  14. macro(_apu_invoke _varname _regexp)
  15. execute_process(
  16. COMMAND ${APRUTIL_CONFIG_EXECUTABLE} ${ARGN}
  17. OUTPUT_VARIABLE _apr_output
  18. RESULT_VARIABLE _apr_failed
  19. )
  20. if(_apr_failed)
  21. message(FATAL_ERROR "apu-1-config ${ARGN} failed")
  22. else(_apr_failed)
  23. string(REGEX REPLACE "[\r\n]" "" _apr_output "${_apr_output}")
  24. string(REGEX REPLACE " +$" "" _apr_output "${_apr_output}")
  25. if(NOT ${_regexp} STREQUAL "")
  26. string(REGEX REPLACE "${_regexp}" " " _apr_output "${_apr_output}")
  27. endif(NOT ${_regexp} STREQUAL "")
  28. separate_arguments(_apr_output)
  29. set(${_varname} "${_apr_output}")
  30. endif(_apr_failed)
  31. endmacro(_apu_invoke)
  32. _apu_invoke(APRUTIL_INCLUDES "(^| )-I" --includes)
  33. _apu_invoke(APRUTIL_LIBS "" --link-ld)
  34. if(APRUTIL_LIBS AND APRUTIL_INCLUDES)
  35. set(APRUTIL_FOUND "YES")
  36. set(APRUTIL_DEFINITIONS "")
  37. message (STATUS "apr-util found: YES ${APRUTIL_LIBS}")
  38. endif(APRUTIL_LIBS AND APRUTIL_INCLUDES)