From eb317a701b83bf9a4f2a035d75747a3d76a48324 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Wed, 21 Oct 2020 00:01:29 -0700 Subject: Export of internal Abseil changes -- d09230db053c544c2dc7fd7d95d1ebe4302071e9 by Abseil Team : Move testonly_uses_linear_node_search to BtreeNodePeer PiperOrigin-RevId: 338210523 -- 7b11c945dbba7a354103c194877eba240f7f0cbc by Derek Mauro : Allow pinning to a GoogleTest commit to make the build reproducible Allow using a cached copy of the commit to avoid depending on GitHub PiperOrigin-RevId: 338115715 -- 8414f496c570a6398744da8324e158b39a2e3d92 by Andy Getzendanner : Generate a pkg-config file per absl_cc_library. PiperOrigin-RevId: 337986219 GitOrigin-RevId: d09230db053c544c2dc7fd7d95d1ebe4302071e9 Change-Id: Iae398ab8ad5c0c6833abd01aa5198315f5b6fa99 --- CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index bc195e04..c1ae8d56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,12 +95,13 @@ find_package(Threads REQUIRED) option(ABSL_USE_EXTERNAL_GOOGLETEST "If ON, Abseil will assume that the targets for GoogleTest are already provided by the including project. This makes sense when Abseil is used with add_subproject." OFF) - option(ABSL_USE_GOOGLETEST_HEAD - "If ON, abseil will download HEAD from googletest at config time." OFF) + "If ON, abseil will download HEAD from GoogleTest at config time." OFF) + +set(ABSL_GOOGLETEST_DOWNLOAD_URL "" CACHE STRING "If set, download GoogleTest from this URL") set(ABSL_LOCAL_GOOGLETEST_DIR "/usr/src/googletest" CACHE PATH - "If ABSL_USE_GOOGLETEST_HEAD is OFF, specifies the directory of a local googletest checkout." + "If ABSL_USE_GOOGLETEST_HEAD is OFF and ABSL_GOOGLETEST_URL is not set, specifies the directory of a local GoogleTest checkout." ) option(ABSL_RUN_TESTS "If ON, Abseil tests will be run." OFF) @@ -113,7 +114,15 @@ if(${ABSL_RUN_TESTS}) ## check targets if (NOT ABSL_USE_EXTERNAL_GOOGLETEST) set(absl_gtest_build_dir ${CMAKE_BINARY_DIR}/googletest-build) - if(${ABSL_USE_GOOGLETEST_HEAD}) + if(ABSL_USE_GOOGLETEST_HEAD AND ABSL_GOOGLETEST_DOWNLOAD_URL) + message(FATAL_ERROR "Do not set both ABSL_USE_GOOGLETEST_HEAD and ABSL_GOOGLETEST_DOWNLOAD_URL") + endif() + if(ABSL_USE_GOOGLETEST_HEAD) + set(absl_gtest_download_url "https://github.com/google/googletest/archive/master.zip") + elseif(ABSL_GOOGLETEST_DOWNLOAD_URL) + set(absl_gtest_download_url ${ABSL_GOOGLETEST_DOWNLOAD_URL}) + endif() + if(absl_gtest_download_url) set(absl_gtest_src_dir ${CMAKE_BINARY_DIR}/googletest-src) else() set(absl_gtest_src_dir ${ABSL_LOCAL_GOOGLETEST_DIR}) -- cgit v1.2.3