xref: /aosp_15_r20/external/tensorflow/tensorflow/lite/tools/cmake/modules/abseil-cpp.cmake (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1#
2# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      https://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# Use absl_base as a proxy for the project being included.
17if(TARGET absl_base OR abseil-cpp_POPULATED)
18  return()
19endif()
20
21include(OverridableFetchContent)
22
23OverridableFetchContent_Declare(
24  abseil-cpp
25  GIT_REPOSITORY https://github.com/abseil/abseil-cpp
26  # Sync with tensorflow/third_party/absl/workspace.bzl
27  GIT_TAG 273292d1cfc0a94a65082ee350509af1d113344d
28  GIT_SHALLOW TRUE
29  GIT_PROGRESS TRUE
30  PREFIX "${CMAKE_BINARY_DIR}"
31  SOURCE_DIR "${CMAKE_BINARY_DIR}/abseil-cpp"
32)
33OverridableFetchContent_GetProperties(abseil-cpp)
34if(NOT abseil-cpp_POPULATED)
35  OverridableFetchContent_Populate(abseil-cpp)
36endif()
37
38set(ABSL_USE_GOOGLETEST_HEAD OFF CACHE BOOL "Disable googletest")
39set(ABSL_RUN_TESTS OFF CACHE BOOL "Disable build of ABSL tests")
40add_subdirectory(
41  "${abseil-cpp_SOURCE_DIR}"
42  "${abseil-cpp_BINARY_DIR}"
43)
44
45