|
| 1 | +# Copyright 2020 Contributors to mod_md project |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# One must set a hint: APR_ROOT_DIR, APRUTIL_ROOT_DIR |
| 16 | +# Find the APR includes and libraries |
| 17 | +# Module defines |
| 18 | +# APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, apr.h, etc. |
| 19 | +# APR_LIBRARIES and APRUTIL_LIBRARIES, libs needed to use APR. |
| 20 | +# APR_FOUND and APRUTIL_FOUND, whether APR usable. |
| 21 | +# Defined: |
| 22 | +# APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library. |
| 23 | + |
| 24 | +IF(NOT APR_ROOT_DIR) |
| 25 | + message(FATAL_ERROR "APR_ROOT_DIR is not set. We don't know where to look for APR, quitting.") |
| 26 | +ENDIF() |
| 27 | + |
| 28 | +IF(NOT APRUTIL_ROOT_DIR) |
| 29 | + message(FATAL_ERROR "APR_ROOT_DIR is not set. We don't know where to look for APR, quitting.") |
| 30 | +ENDIF() |
| 31 | + |
| 32 | +FIND_PATH(APR_INCLUDE_DIR apr.h |
| 33 | + "${APR_ROOT_DIR}/include" |
| 34 | +) |
| 35 | +SET(APR_NAMES ${APR_NAMES} libapr-1 apr-1) |
| 36 | +FIND_LIBRARY(APR_LIBRARY NAMES ${APR_NAMES} PATHS "${APR_ROOT_DIR}/lib" "${APR_ROOT_DIR}/lib64") |
| 37 | +IF (APR_LIBRARY AND APR_INCLUDE_DIR) |
| 38 | + SET(APR_LIBRARIES ${APR_LIBRARY}) |
| 39 | + SET(APR_FOUND "YES") |
| 40 | +ELSE (APR_LIBRARY AND APR_INCLUDE_DIR) |
| 41 | + SET(APR_FOUND "NO") |
| 42 | +ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR) |
| 43 | + |
| 44 | +IF (APR_FOUND) |
| 45 | + IF (NOT APR_FIND_QUIETLY) |
| 46 | + MESSAGE(STATUS "Found APR: ${APR_LIBRARIES}") |
| 47 | + ENDIF (NOT APR_FIND_QUIETLY) |
| 48 | +ELSE (APR_FOUND) |
| 49 | + IF (APR_FIND_REQUIRED) |
| 50 | + MESSAGE(FATAL_ERROR "Could not find APR library") |
| 51 | + ENDIF (APR_FIND_REQUIRED) |
| 52 | +ENDIF (APR_FOUND) |
| 53 | + |
| 54 | +MARK_AS_ADVANCED( |
| 55 | + APR_LIBRARY |
| 56 | + APR_INCLUDE_DIR |
| 57 | +) |
| 58 | + |
| 59 | +# APR Util |
| 60 | +FIND_PATH(APRUTIL_INCLUDE_DIR apu.h |
| 61 | + "${APRUTIL_ROOT_DIR}/include" |
| 62 | +) |
| 63 | + |
| 64 | +SET(APRUTIL_NAMES ${APRUTIL_NAMES} libaprutil-1 aprutil-1) |
| 65 | +FIND_LIBRARY(APRUTIL_LIBRARY |
| 66 | + NAMES ${APRUTIL_NAMES} |
| 67 | + PATHS "${APRUTIL_ROOT_DIR}/lib" "${APRUTIL_ROOT_DIR}/lib64" |
| 68 | +) |
| 69 | + |
| 70 | +IF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) |
| 71 | + SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY}) |
| 72 | + SET(APRUTIL_FOUND "YES") |
| 73 | +ELSE (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) |
| 74 | + SET(APRUTIL_FOUND "NO") |
| 75 | +ENDIF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) |
| 76 | + |
| 77 | +IF (APRUTIL_FOUND) |
| 78 | + IF (NOT APRUTIL_FIND_QUIETLY) |
| 79 | + MESSAGE(STATUS "Found APRUTIL: ${APRUTIL_LIBRARIES}") |
| 80 | + ENDIF (NOT APRUTIL_FIND_QUIETLY) |
| 81 | +ELSE (APRUTIL_FOUND) |
| 82 | + IF (APRUTIL_FIND_REQUIRED) |
| 83 | + MESSAGE(FATAL_ERROR "Could not find APRUTIL library") |
| 84 | + ENDIF (APRUTIL_FIND_REQUIRED) |
| 85 | +ENDIF (APRUTIL_FOUND) |
| 86 | + |
| 87 | +MARK_AS_ADVANCED( |
| 88 | + APRUTIL_LIBRARY |
| 89 | + APRUTIL_INCLUDE_DIR |
| 90 | +) |
0 commit comments