FindAPR.cmake 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # Licensed to the Apache Software Foundation (ASF) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The ASF licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing,
  12. # software distributed under the License is distributed on an
  13. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. # KIND, either express or implied. See the License for the
  15. # specific language governing permissions and limitations
  16. # under the License.
  17. # - Find Apache Portable Runtime
  18. # Find the APR includes and libraries
  19. # This module defines
  20. # APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, where to find apr.h, etc.
  21. # APR_LIBRARIES and APRUTIL_LIBRARIES, the libraries needed to use APR.
  22. # APR_FOUND and APRUTIL_FOUND, If false, do not try to use APR.
  23. # also defined, but not for general use are
  24. # APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library.
  25. # APR first.
  26. FIND_PATH(APR_INCLUDE_DIR apr.h
  27. /usr/local/include/apr-1
  28. /usr/local/include/apr-1.0
  29. /usr/include/apr-1
  30. /usr/include/apr-1.0
  31. /opt/local/include/apr-1
  32. /opt/local/include/apr-1.0
  33. )
  34. SET(APR_NAMES ${APR_NAMES} apr-1)
  35. FIND_LIBRARY(APR_LIBRARY
  36. NAMES ${APR_NAMES}
  37. PATHS /usr/lib /usr/local/lib /opt/local/lib
  38. )
  39. IF (APR_LIBRARY AND APR_INCLUDE_DIR)
  40. SET(APR_LIBRARIES ${APR_LIBRARY})
  41. SET(APR_FOUND "YES")
  42. ELSE (APR_LIBRARY AND APR_INCLUDE_DIR)
  43. SET(APR_FOUND "NO")
  44. ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR)
  45. IF (APR_FOUND)
  46. IF (NOT APR_FIND_QUIETLY)
  47. MESSAGE(STATUS "Found APR: ${APR_LIBRARIES}")
  48. ENDIF (NOT APR_FIND_QUIETLY)
  49. ELSE (APR_FOUND)
  50. IF (APR_FIND_REQUIRED)
  51. MESSAGE(FATAL_ERROR "Could not find APR library")
  52. ENDIF (APR_FIND_REQUIRED)
  53. ENDIF (APR_FOUND)
  54. # Deprecated declarations.
  55. SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} )
  56. GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH)
  57. MARK_AS_ADVANCED(
  58. APR_LIBRARY
  59. APR_INCLUDE_DIR
  60. )
  61. # Next, APRUTIL.
  62. FIND_PATH(APRUTIL_INCLUDE_DIR apu.h
  63. /usr/local/include/apr-1
  64. /usr/local/include/apr-1.0
  65. /usr/include/apr-1
  66. /usr/include/apr-1.0
  67. /opt/local/include/apr-1
  68. /opt/local/include/apr-1.0
  69. )
  70. SET(APRUTIL_NAMES ${APRUTIL_NAMES} aprutil-1)
  71. FIND_LIBRARY(APRUTIL_LIBRARY
  72. NAMES ${APRUTIL_NAMES}
  73. PATHS /usr/lib /usr/local/lib /opt/local/lib
  74. )
  75. IF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
  76. SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY})
  77. SET(APRUTIL_FOUND "YES")
  78. ELSE (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
  79. SET(APRUTIL_FOUND "NO")
  80. ENDIF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR)
  81. IF (APRUTIL_FOUND)
  82. IF (NOT APRUTIL_FIND_QUIETLY)
  83. MESSAGE(STATUS "Found APRUTIL: ${APRUTIL_LIBRARIES}")
  84. ENDIF (NOT APRUTIL_FIND_QUIETLY)
  85. ELSE (APRUTIL_FOUND)
  86. IF (APRUTIL_FIND_REQUIRED)
  87. MESSAGE(FATAL_ERROR "Could not find APRUTIL library")
  88. ENDIF (APRUTIL_FIND_REQUIRED)
  89. ENDIF (APRUTIL_FOUND)
  90. # Deprecated declarations.
  91. SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} )
  92. GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH)
  93. MARK_AS_ADVANCED(
  94. APRUTIL_LIBRARY
  95. APRUTIL_INCLUDE_DIR
  96. )