summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-10-10 11:49:54 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-10-10 11:50:46 -0700
commit2ed6963f2b67a68d94303cafb571d3d039a49f9a (patch)
tree8b0fac270ec3c44dfd895d9d2c0c4fcc5f558157 /CMakeLists.txt
parent76466b85fb9c86be56bfe773667ee6ad4fc3b87f (diff)
CMake: Remove check_target calls which can be problematic in case of dependency cycle
Also renames `_target_compile_features_if_available` CMake function to `_absl_target_compile_features_if_available` since CMake's function namespace is global. The dependency cycle can occur if absl is configured with test helpers enabled, and googletest is configured to use absl. In the case that both projects are being built from source via FetchContent with OVERRIDE_FIND_PACKAGE, depending on the order in which the two projects are added to the build, the check_target calls may fail even though the build would have otherwise succeeded. The existing `check_target` calls seem to have been originally added to detect missing gtest targets when the `GTest::` prefix was not yet in use. For target names without "::", CMake does not warn if they are undefined, and just assumes they refer to system library names. However, CMake does fail during build generation if a target name with "::" is missing; thus the check_taget calls are redundant. PiperOrigin-RevId: 480140797 Change-Id: Ic51631e4a36dd8b6f569ad6424bea15a4af0b875
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt6
1 files changed, 0 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b67d8fe..9e102578 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -140,7 +140,6 @@ set(ABSL_LOCAL_GOOGLETEST_DIR "/usr/src/googletest" CACHE PATH
)
if((BUILD_TESTING AND ABSL_BUILD_TESTING) OR ABSL_BUILD_TEST_HELPERS)
- ## check targets
if (ABSL_USE_EXTERNAL_GOOGLETEST)
if (ABSL_FIND_GOOGLETEST)
find_package(GTest REQUIRED)
@@ -172,11 +171,6 @@ if((BUILD_TESTING AND ABSL_BUILD_TESTING) OR ABSL_BUILD_TEST_HELPERS)
endif()
include(CMake/Googletest/DownloadGTest.cmake)
endif()
-
- check_target(GTest::gtest)
- check_target(GTest::gtest_main)
- check_target(GTest::gmock)
- check_target(GTest::gmock_main)
endif()
add_subdirectory(absl)