|
| 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 | + |
| 18 | +if(abslAlt_FOUND) |
| 19 | + return() |
| 20 | +endif() |
| 21 | + |
| 22 | +set(find_package_args) |
| 23 | + |
| 24 | +if(abslAlt_FIND_QUIETLY) |
| 25 | + list(APPEND find_package_args QUIET) |
| 26 | +endif() |
| 27 | +if(abslAlt_FIND_REQUIRED) |
| 28 | + list(APPEND find_package_args REQUIRED) |
| 29 | +endif() |
| 30 | + |
| 31 | +find_package(absl ${find_package_args}) |
| 32 | + |
| 33 | +if(NOT DEFINED absl_VERSION) |
| 34 | + # Abseil does not define a version when build 'live at head'. |
| 35 | + # As this is their recommended path we need to define a large version to pass version checks. |
| 36 | + # CMake removes the '_head' suffix for version comparison but it will show up in the logs |
| 37 | + # and matches the abseil-cpp.pc version of 'head' |
| 38 | + set(absl_VERSION 99999999_head) |
| 39 | +endif() |
| 40 | + |
| 41 | +set(abslAlt_VERSION ${absl_VERSION}) |
| 42 | + |
| 43 | +find_package_handle_standard_args( |
| 44 | + abslAlt |
| 45 | + REQUIRED_VARS absl_FOUND |
| 46 | + VERSION_VAR abslAlt_VERSION) |
0 commit comments